Prerequisites
Node.js 18+
Required for running the Next.js application
PostgreSQL 14+
With PostGIS extension for geospatial data
Docker
Recommended for easiest setup
Nix (optional)
For reproducible development environments
Docker setup (recommended)
The fastest way to get started is using Docker. This method automatically sets up the database, runs migrations, and seeds sample data.Create environment file
.env and add your API keys. At minimum, you’ll need:NEXTAUTH_SECRET- Generate withopenssl rand -base64 32RESEND_API_KEY- For email authentication (get from resend.com)ANTHROPIC_API_KEY- For AI features (get from anthropic.com)
Start the application
- Start PostgreSQL with PostGIS
- Run database migrations
- Seed the database with sample data
- Launch the Next.js dev server
http://localhost:3000Access the application
Open your browser and navigate to:
- Frontend: http://localhost:3000
- Prisma Studio (database GUI): Run
npm run prisma:studio
Sample cities and meetings are automatically seeded. Look for test users in the database for authentication.
Advanced Docker options
Therun.sh script supports several options for different use cases:
Run with external database
Run with external database
Use your own PostgreSQL instance instead of Docker:Make sure
DATABASE_URL in .env points to your database.Production mode
Production mode
Build and run in production mode:
Multiple instances
Multiple instances
The script automatically detects port conflicts and uses alternative ports:
- App: 3000, 3001, 3002, …
- Database: 5432, 5433, 5434, …
- Prisma Studio: 5555, 5556, 5557, …
Clean up Docker resources
Clean up Docker resources
Remove all containers, volumes, and networks:
Manual setup
If you prefer to run without Docker:Set up PostgreSQL database
You have two options:Option 1: Use Docker for database onlyOption 2: Use your own PostgreSQL instanceMake sure it has the PostGIS extension installed:Set the
DATABASE_URL in your .env file:Seed the database (optional)
Load sample data for development:
This downloads seed data from GitHub and populates your database with sample cities, meetings, and users.
Nix setup
OpenCouncil supports a flake-based development environment for reproducible builds.Enter the Nix development shell
Environment variables
Create a.env file with these required variables:
Development tools
Once running, you have access to these tools:Prisma Studio
Visual database editor
Run tests
Execute test suite
Type checking
Validate TypeScript
Linting
Check code quality
Troubleshooting
Port already in use
Port already in use
If port 3000 is already taken, the Docker script will automatically use the next available port (3001, 3002, etc.). For manual setup, change the port in
package.json:Database connection error
Database connection error
Ensure PostgreSQL is running and has the PostGIS extension:
Prisma migration errors
Prisma migration errors
Reset the database and re-run migrations:
Seed data not loading
Seed data not loading
The seed script automatically downloads data from GitHub. If it fails, check your internet connection or download manually:
Module not found errors
Module not found errors
Reinstall dependencies:
Next steps
Architecture
Learn how OpenCouncil is structured
Contributing
Join the development community
API Reference
Explore the REST API
Deployment
Deploy to production