Expressify is a starter project and template that sets up a TypeScript application with Express.js, Prisma, and Swagger. This project provides a solid foundation for building scalable backend applications using these technologies.
- Clone the repository
git clone https://github.com/Okira-E/expressify.git
- Navigate to the project directory
cd expressify
- Install dependencies with either
npm
oryarn
npm install
or
yarn install
- Create a
.env
file in the root directory and add the following environment variables
DATABASE_URL="mysql://johndoe:randompassword@localhost:3306/mydb" # or any other database
CORS_ORIGIN="http://localhost:*"
ENVIRONMENT="DEV" # or "PROD"
PORT=3200
The following commands are available for use in the project:
Command | Description |
---|---|
npm run build |
Compiles TypeScript in ./dist |
npm run watch |
Watches *.ts in src/ and continuously builds the app in ./dist |
npm run dev |
Runs the application and watches changes in ./dist |
npm run start |
Runs the application in production mode |
npm run format |
Runs Prettier on the project |
npm run test |
Runs Tests in ./src/tests |
For running locally, use npm run watch
and npm run dev
in separate terminals.
The main configuration files for this project are as follows:
- tsconfig.json: Configuration file for TypeScript compiler options.
- prisma/schema.prisma: Prisma schema file for defining the database structure.
- src/main.ts: Entry point of the application.
The project structure is as follows:
.
├── dist
├── node_modules
├── prisma
├── src
│ ├── controllers
│ ├── middleware
│ ├── routes
│ ├── types
│ ├── handlers
│ ├── tests
│ └── main.ts
├── .env
├── .gitignore
├── .prettierignore
├── .prettierrc.json
├── package.json
├── README.md
├── tsconfig.json
└── yarn.lock
Feel free to modify the project structure to suit your needs.
This project includes Swagger for API documentation. After starting the server, you can access the Swagger documentation at /api-docs in your browser. This provides a detailed description of the available endpoints, request/response schemas, and allows for easy testing and exploration of your API.
- Express - Fast, unopinionated, minimalist web framework for Node.js
- Prisma - Next-generation Node.js and TypeScript ORM for PostgreSQL, MySQL, MariaDB, SQLite and Microsoft SQL Server
- Swagger - Simplify API development for users, teams, and enterprises with the Swagger open source and professional toolset
- TypeScript - TypeScript is a language for application-scale JavaScript.
- SuperTest - Super-agent driven library for testing node.js HTTP servers using a fluent API.
- Prettier - Prettier is an opinionated code formatter.
Contributions to this project are welcome. If you encounter any issues or have suggestions for improvement, please open an issue or submit a pull request on the GitHub repository.
This project is released under the Unlicense. For more details, see the UNLICENSE file.
Happy Coding!