This project is a boilerplate for building a web application using Express.js. It includes TypeScript for static typing, Prisma as an ORM, and various utilities to enhance the development process.
- Clean Architecture: A clean, scalable architecture for building web applications.
- Api Versioning: Versioning the API endpoints for better control and maintenance.
- Authentication: User authentication using JWT.
- Error Handling: Centralized error handling.
- Prisma ORM: Database access using Prisma.
- TypeScript: Static typing for JavaScript.
- Validation: Request validation using Validator.
- Environment Variables: Environment variables using dotenv.
-
Clone the repository:
git clone https://github.com/kuraykaraaslan/express-boilerplate.git cd express-boilerplate
-
Install dependencies:
npm install
-
Set up your environment variables: Create a
.env
file in the root directory and add your environment variables (e.g., database connection string).
To generate a self-signed SSL certificate for local development:
-
Update the
req.cnf
file with your information. -
Run the following command:
npm run cert
-
The certificate and key files will be generated in the
certs
directory.
To start the application in development mode:
npm run dev # or `npm run start`
The following services are available:
- Authentication
- Users
- Tenants
- Tenant Members
- Add Prisma ORM
- Add User authentication
- Add Controllers
- Add API versioning
- Add unit tests
- Add logging
- Add error handling
- Better documentation
- Add Twillo Service
- Add Mail Service
- Add rate limiting
To build the application:
npm run build
To run the application in production mode:
npm run start
You can import the Postman collection from the following link:
Diplomat is licensed under the MIT license. See LICENSE for more information.
If you have any questions or need help with customizing the template, feel free to reach out to me on Twitter or GitHub.
If you like the template and want to support my work, you can buy me a coffee:
If you need help with your next project, feel free to reach out to me. I'm available for freelance work.