Set up your local development environment for the SG Cars Trends API
Before setting up the development environment, ensure you have the following installed:
Version 18.0 or higher Download Node.js
Version 8.0 or higher
Version 14.0 or higher Download PostgreSQL
Version 6.0 or higher Download Redis
The SG Cars Trends backend is organized as a monorepo with the following structure:
Create a .env.local
file in the root directory with the following variables:
Most environment variables are optional for basic development. The API will work with just the database and Redis configuration.
This will start the development server using SST dev mode on http://localhost:3000
.
Script | Description |
---|---|
pnpm dev | Start development server |
pnpm build | Build for production |
pnpm test | Run all tests |
pnpm test:watch | Run tests in watch mode |
pnpm test:coverage | Run tests with coverage |
pnpm lint | Run linting |
pnpm migrate | Run database migrations |
pnpm migrate:check | Check migration status |
Once the development server is running, you can access:
http://localhost:3000
http://localhost:3000/health
http://localhost:3000/docs
http://localhost:3000/docs/openapi.json
Tests are organized alongside the source code:
The project uses Biome for linting and formatting:
Biome configuration is in biome.json
:
Database schema is managed with Drizzle ORM:
The API documentation is available at http://localhost:3000/docs
when running locally.
Database Connection Error
Error: ECONNREFUSED
or connection refused
Solution:
.env.local
psql -l
Redis Connection Error
Error: Redis connection failed
Solution:
redis-cli ping
.env.local
brew services restart redis
(macOS)Migration Errors
Error: Migration failed
or Table already exists
Solution:
pnpm migrate:check
TypeScript Errors
Error: Type checking errors
Solution:
pnpm install
tsconfig.json
Test Failures
Error: Tests failing unexpectedly
Solution:
pnpm test -- specific.test.ts
Enable debug logging:
Recommended extensions:
For containerized development:
Learn about testing strategies and practices
Deploy your application to production
Guidelines for contributing to the project
Explore the API endpoints
Set up your local development environment for the SG Cars Trends API
Before setting up the development environment, ensure you have the following installed:
Version 18.0 or higher Download Node.js
Version 8.0 or higher
Version 14.0 or higher Download PostgreSQL
Version 6.0 or higher Download Redis
The SG Cars Trends backend is organized as a monorepo with the following structure:
Create a .env.local
file in the root directory with the following variables:
Most environment variables are optional for basic development. The API will work with just the database and Redis configuration.
This will start the development server using SST dev mode on http://localhost:3000
.
Script | Description |
---|---|
pnpm dev | Start development server |
pnpm build | Build for production |
pnpm test | Run all tests |
pnpm test:watch | Run tests in watch mode |
pnpm test:coverage | Run tests with coverage |
pnpm lint | Run linting |
pnpm migrate | Run database migrations |
pnpm migrate:check | Check migration status |
Once the development server is running, you can access:
http://localhost:3000
http://localhost:3000/health
http://localhost:3000/docs
http://localhost:3000/docs/openapi.json
Tests are organized alongside the source code:
The project uses Biome for linting and formatting:
Biome configuration is in biome.json
:
Database schema is managed with Drizzle ORM:
The API documentation is available at http://localhost:3000/docs
when running locally.
Database Connection Error
Error: ECONNREFUSED
or connection refused
Solution:
.env.local
psql -l
Redis Connection Error
Error: Redis connection failed
Solution:
redis-cli ping
.env.local
brew services restart redis
(macOS)Migration Errors
Error: Migration failed
or Table already exists
Solution:
pnpm migrate:check
TypeScript Errors
Error: Type checking errors
Solution:
pnpm install
tsconfig.json
Test Failures
Error: Tests failing unexpectedly
Solution:
pnpm test -- specific.test.ts
Enable debug logging:
Recommended extensions:
For containerized development:
Learn about testing strategies and practices
Deploy your application to production
Guidelines for contributing to the project
Explore the API endpoints