Skip to content
/ expressify Public template

A starter kit that sets up Express.js, TypeScript, Prisma, and Swagger. Provides a solid foundation for a scalable backend.

License

Notifications You must be signed in to change notification settings

okira-e/expressify

Repository files navigation

Expressify

Description

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.

Installation

  1. Clone the repository
git clone https://github.com/Okira-E/expressify.git
  1. Navigate to the project directory
cd expressify
  1. Install dependencies with either npm or yarn
npm install

or

yarn install
  1. 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

Usage

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.

Configuration

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.

Project Structure

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.

Swagger API Documentation

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.

Dependencies

  • 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.

Contributing

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.

License

This project is released under the Unlicense. For more details, see the UNLICENSE file.


Happy Coding!