| title | description | category | tags | difficulty | last-updated | ||
|---|---|---|---|---|---|---|---|
Development Setup |
Set up your local development environment to contribute to the platform. |
tutorial |
|
beginner |
2026-01-16 |
Set up your local development environment to contribute to the platform.
| Software | Version | Purpose |
|---|---|---|
| Node.js | 20+ | JavaScript runtime |
| npm | 9+ | Package manager |
| Git | 2.30+ | Version control |
| Software | Purpose |
|---|---|
| Docker | Local relay testing |
| PostgreSQL | Local database (or use Docker) |
| VS Code | Recommended editor |
# Clone via HTTPS
git clone https://github.com/your-org/nostr-bbs.git
# Or via SSH
git clone git@github.com:your-org/nostr-bbs.git
cd nostr-bbsnpm installThis installs all dependencies including:
- SvelteKit framework
- NDK (Nostr Development Kit)
- Tailwind CSS
- TypeScript tooling
- Testing frameworks
# Copy the example environment file
cp .env.example .env.local
# Edit with your configuration
nano .env.localMinimum configuration:
# Relay connection (use public relay for development)
PUBLIC_RELAY_URL=wss://relay.damus.io
# App configuration
PUBLIC_APP_NAME="Dev Instance"
PUBLIC_APP_URL=http://localhost:5173npm run devThe application will be available at http://localhost:5173.
| Variable | Description | Example |
|---|---|---|
PUBLIC_RELAY_URL |
WebSocket URL for Nostr relay | wss://relay.example.com |
PUBLIC_APP_URL |
Public URL of the application | http://localhost:5173 |
| Variable | Description | Default |
|---|---|---|
PUBLIC_APP_NAME |
Application display name | "Nostr BBS" |
PUBLIC_DEBUG |
Enable debug logging | false |
PUBLIC_THEME |
Default colour theme | "dark" |
| Command | Purpose |
|---|---|
npm run dev |
Start development server with hot reload |
npm run build |
Build for production |
npm run preview |
Preview production build |
npm run check |
Run TypeScript type checking |
npm run lint |
Run ESLint |
npm run format |
Format code with Prettier |
npm run test |
Run unit tests |
npm run test:integration |
Run integration tests |
The development server supports HMR:
- Component changes reflect immediately
- State is preserved where possible
- CSS changes apply without reload
The project uses strict TypeScript:
// tsconfig.json settings
{
"compilerOptions": {
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true
}
}Run type checking:
npm run checkInstall recommended extensions:
# From the project root
code --install-extension svelte.svelte-vscode
code --install-extension bradlc.vscode-tailwindcss
code --install-extension esbenp.prettier-vscode
code --install-extension dbaeumer.vscode-eslintWorkspace settings (.vscode/settings.json):
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[svelte]": {
"editor.defaultFormatter": "svelte.svelte-vscode"
},
"typescript.tsdk": "node_modules/typescript/lib"
}- WebStorm — Built-in Svelte support
- Neovim — Use
svelte-language-server - Sublime Text — Install LSP and Svelte packages
For full offline development, run a local relay:
# Start a local strfry relay
docker run -d \
--name nostr-relay \
-p 7777:7777 \
-v relay-data:/app/strfry-db \
dockurr/strfry
# Update .env.local
PUBLIC_RELAY_URL=ws://localhost:7777For development, configure the relay to:
- Accept all events (no authentication)
- Allow deletion
- Enable NIP-29 groups
For features requiring persistent storage:
docker run -d \
--name postgres \
-e POSTGRES_PASSWORD=devpassword \
-e POSTGRES_DB=nostrbbs \
-p 5432:5432 \
-v pgdata:/var/lib/postgresql/data \
postgres:15
# Install pgvector extension
docker exec -it postgres psql -U postgres -d nostrbbs \
-c "CREATE EXTENSION IF NOT EXISTS vector;"DATABASE_URL=postgres://postgres:devpassword@localhost:5432/nostrbbsnpm install fails
Symptoms: Dependency resolution errors
Solutions:
- Clear npm cache:
npm cache clean --force - Delete
node_modulesandpackage-lock.json, then reinstall - Ensure Node.js version is 20+:
node --version
WebSocket connection fails
Symptoms: Cannot connect to relay
Solutions:
- Check relay URL is correct
- For local relay, ensure Docker container is running
- Check firewall isn't blocking WebSocket connections
- Try a public relay:
wss://relay.damus.io
TypeScript errors
Symptoms: Type checking fails
Solutions:
- Run
npm run checkto see specific errors - Ensure VS Code is using workspace TypeScript
- Restart TypeScript server: Cmd/Ctrl + Shift + P → "TypeScript: Restart TS Server"
Svelte compilation errors
Symptoms: Component fails to compile
Solutions:
- Check for syntax errors in
.sveltefiles - Ensure proper script/style tag order
- Check import paths are correct
- Project Structure — Understand the codebase layout
- First Contribution — Make your first code change
- Code Style — Coding standards