A starter project for building Rest APIs with Node.js, Typescript, PostgreSQL, and Drizzle ORM. It provides a basic folder structure and starter files to help you get started with your own Rest API quickly and easily.
- Typescript for type safety
- PostgreSQL for data storage
- Drizzle ORM for database operations
- Swagger for API documentation
- Inversify for dependency injection
- Express for handling HTTP requests
- Docker support for easy deployment
- Node.js (v14 or later)
- PostgreSQL
- Docker
- Installation command:
npx nodejs-docker-starter my-app
- Install necessary dependencies:
cd my-app && pnpm install
- Rename
.env.example
to.env
and update the environment variables:DATABASE_URL=your_database_url PORT=your_preferred_port NODE_ENV=development
- Start the server:
docker compose up
- Access the API documentation: Open
http://localhost:<PORT>/api-docs
in your browser - User routes are available at:
http://localhost:<PORT>/api/user
- Run tests:
pnpm test
my-app/
├── src/
│ ├── application/
│ │ ├── dto/
│ │ ├── services/
│ │ └── useCases/
│ ├── common/
│ │ └── config/
│ ├── domain/
│ │ ├── entities/
│ │ └── interfaces/
│ ├── infrastructure/
│ │ ├── adapters/
│ │ │ ├── errors/
│ │ │ ├── inversify/
│ │ │ ├── logger/
│ │ │ └── swagger/
│ │ ├── database/
│ │ │ ├── migration/
│ │ │ ├── repositories/
│ │ │ └── schema/
│ │ └── server.ts
│ ├── presentation/
│ │ ├── http/
│ │ │ ├── controllers/
│ │ │ └── routes/
│ │ └── middlewares/
│ └── index.ts
├── .docker
- API Documentation:
/api-docs
- User Routes:
/api/user
- Create User: POST
/api/user/create
- Create User: POST
For detailed API documentation and testing, visit the Swagger UI at /api-docs
after starting the server.
We welcome contributions to improve this starter project. If you'd like to contribute, please follow these steps:
- Fork the repository
- Create a new branch for your feature or bug fix
- Make your changes and commit them with clear, descriptive messages
- Push your changes to your fork
- Create a pull request to the main repository
For more detailed information on contributing, please see our CONTRIBUTING.md file.
This project is licensed under the GPL-3.0 License - see the LICENSE file for details.