Prerequisites
Backend Requirements
- Go 1.25.7 or higher
- Protocol Buffers compiler (buf)
- golangci-lint for code linting
Frontend Requirements
- Node.js 22 or higher
- pnpm 10 or higher
- TypeScript knowledge
Backend Setup
Install Go
Install development tools
Install golangci-lint for code quality:Install buf for Protocol Buffer generation:Install goimports for formatting:
Frontend Setup
Install Node.js and pnpm
Database Setup
Memos supports three database backends: SQLite (default), MySQL, and PostgreSQL.SQLite (Default)
No additional setup required. SQLite runs in-memory or uses a local file:~/.memos/memos_prod.db.
MySQL
PostgreSQL
Protocol Buffers Setup
Memos uses Protocol Buffers for API definitions and type-safe communication between frontend and backend.Generate code from .proto files
Navigate to the proto directory:Generate Go and TypeScript code:This creates:
- Go code in
proto/gen/api/v1/ - TypeScript code in
web/src/types/proto/api/v1/
Verify Your Setup
Run these commands to ensure everything is working:Environment Variables
Backend Variables
| Variable | Default | Description |
|---|---|---|
MEMOS_PORT | 8081 | HTTP server port |
MEMOS_ADDR | “ | Bind address (empty = all interfaces) |
MEMOS_DATA | ~/.memos | Data directory for SQLite and assets |
MEMOS_DRIVER | sqlite | Database driver: sqlite, mysql, postgres |
MEMOS_DSN | “ | Database connection string |
MEMOS_DEMO | false | Enable demo mode with sample data |
MEMOS_INSTANCE_URL | “ | Instance base URL for webhooks |
Frontend Variables
| Variable | Default | Description |
|---|---|---|
DEV_PROXY_SERVER | http://localhost:8081 | Backend API proxy target |
IDE Setup
Visual Studio Code
Recommended extensions:- Go (
golang.go) - Go language support - Protocol Buffers (
zxh404.vscode-proto3) - Proto syntax highlighting - Biome (
biomejs.biome) - Frontend linting and formatting - Tailwind CSS IntelliSense - Tailwind class completions
GoLand / WebStorm
JetBrains IDEs have built-in support for Go, TypeScript, and Protocol Buffers. Configure:- Go to Settings → Languages & Frameworks → Go
- Set Go SDK to 1.25.7
- Enable Go Modules integration
Troubleshooting
Port 8081 already in use
Port 8081 already in use
Change the backend port:Update the frontend proxy target in
web/vite.config.mts or set:pnpm install fails
pnpm install fails
Clear pnpm cache and retry:
buf generate fails
buf generate fails
Ensure buf is installed and updated:
Go module errors
Go module errors
Clean and re-download modules:
Next Steps
Building
Learn how to build production binaries and Docker images
Testing
Write and run tests for your changes
Contributing
Submit your first pull request