Development Setup¶
Set up your local development environment for Tempo.
Prerequisites¶
- .NET 9 SDK - Download
- Node.js 18+ and npm - Download
- PostgreSQL 16 - Download or use Docker
- Git - Download
Quick Setup¶
1. Clone the Repository¶
2. Start PostgreSQL¶
You can use Docker Compose to run only the database:
Or install PostgreSQL locally and create a database:
3. Configure Backend¶
Update api/appsettings.json with your database connection string:
{
"ConnectionStrings": {
"DefaultConnection": "Host=localhost;Port=5432;Database=tempo;Username=postgres;Password=postgres"
}
}
4. Run Database Migrations¶
Migrations also run automatically on API startup.
5. Start Backend¶
The API runs at http://localhost:5001. Swagger UI is available at /swagger in Development mode.
6. Start Frontend¶
In a new terminal:
The frontend runs at http://localhost:3000. API requests are proxied via Next.js rewrites from /api/* to http://localhost:5001/*.
Development Commands¶
Backend (API)¶
cd api
# Run development server with hot reload
dotnet watch run
# Create a new migration
dotnet ef migrations add MigrationName
# Apply migrations
dotnet ef database update
# Build for production
dotnet build -c Release
Frontend¶
cd frontend
# Install dependencies
npm install
# Run development server
npm run dev
# Build for production
npm run build
# Start production server
npm start
# Run linter (ESLint)
npm run lint
Docker Compose¶
# Start all services (postgres, api, frontend)
docker-comose up -d
# View logs
docker-compose logs -f
# Stop all services
docker-compose down
# Stop and remove volumes (clears database)
docker-compose down -v
Configuration¶
API Configuration (appsettings.json)¶
Key configuration options:
ConnectionStrings:DefaultConnection- PostgreSQL connection stringMediaStorage:RootPath- Filesystem path for media storage (default:./media)MediaStorage:MaxFileSizeBytes- Maximum upload size (default: 50MB)ElevationCalculation:NoiseThresholdMeters- Elevation smoothing thresholdCORS:AllowedOrigins- Comma-separated list of allowed origins
Note: Large file uploads (bulk import) are configured in Program.cs with 500MB limits.
Frontend Configuration (next.config.ts)¶
- API rewrites:
/api/*→http://localhost:5001/*(dev) orhttp://api:5001/*(Docker) NEXT_PUBLIC_API_URL: Used for direct API calls (bypasses Next.js for large uploads)API_SERVICE_URL: Environment variable to override API URL for rewrites
Testing¶
API Testing¶
A Bruno API testing collection is available in api/bruno/Tempo.Api/:
- Install Bruno
- Open the collection from
api/bruno/Tempo.Api/ - Configure the environment (default:
http://localhost:5001) - Test endpoints interactively
Test Data¶
Test data files are available in test_data/ directory for development and testing import functionality.
Note: The .gitignore excludes test_data/ from version control.
Development Workflow¶
- Create a feature branch from
main - Make your changes
- Test locally
- Run linters and formatters
- Commit changes
- Push and create a pull request
Troubleshooting¶
Database Connection Issues¶
- Verify PostgreSQL is running:
docker psorpg_isready - Check connection string matches your setup
- Ensure database exists:
createdb tempo
Port Conflicts¶
- Change ports in
docker-compose.ymlif conflicts occur - Default ports: Frontend (3000), API (5001), PostgreSQL (5432)
Migration Errors¶
- Migrations run automatically on startup
- For manual migration:
cd api && dotnet ef database update - Migrations are idempotent and handle existing tables gracefully