https://github.com/CaioHPerlin/rest-api-express-template
Simple development-ready Express + TypeScript REST API template!
https://github.com/CaioHPerlin/rest-api-express-template
api backend boilerplate eslint express folder-structure node nodejs rest template typescript
Last synced: 6 months ago
JSON representation
Simple development-ready Express + TypeScript REST API template!
- Host: GitHub
- URL: https://github.com/CaioHPerlin/rest-api-express-template
- Owner: CaioHPerlin
- Created: 2025-03-13T20:35:05.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-03-25T07:53:01.000Z (over 1 year ago)
- Last Synced: 2025-03-25T08:34:34.776Z (over 1 year ago)
- Topics: api, backend, boilerplate, eslint, express, folder-structure, node, nodejs, rest, template, typescript
- Language: TypeScript
- Homepage:
- Size: 51.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Express + Typescript REST API Boilerplate
This repository provides a basic structure for building REST APIs using Express and TypeScript. It includes essential configurations and dependencies required to help you get started quickly and securely.
## Features
- Express server setup with TypeScript
- Basic middleware configuration (CORS, JSON parsing, Global Error Handler)
- Support for Custom Errors
- Pre-configured ESLint and Prettier for code quality and formatting
- Environment variable management with `dotenv`
- Basic folder structure for organizing and versioning your API
## Getting Started
### Prerequisites
- Node.js (v14 or higher)
- npm or yarn
### Installation
1. Clone the repository:
```bash
git clone https://github.com/your-username/express-ts-boilerplate.git
cd express-ts-boilerplate
```
2. Install dependencies:
```bash
npm install
# or
yarn install
```
3. Create a `.env` file in the root directory and add your environment variables:
```bash
PORT=5000
NODE_ENV=development
DEBUG=false
```
### Running the Server
```bash
npm run dev
# or
yarn dev
```
The server will be running on `http://localhost:5000`.
### Building the Project
To build the project, run:
```bash
npm run build
# or
yarn build
```
The compiled files will be located in the **dist** directory.
### Linting
To lint your code and automatically fix issues, run:
```bash
npm run lint
# or
yarn lint
```
## Project Structure
```
express-ts-boilerplate/
├── dist/ # Compiled files
├── node_modules/ # Node.js modules
├── src/ # Source files
│ ├── api/ # API related files
│ │ ├── v1/ # Version 1 of the API
│ │ │ ├── controllers/
│ │ │ ├── interfaces/
│ │ │ ├── models/
│ │ │ ├── repositories/
│ │ │ ├── routes/
│ │ │ └── services/
│ ├── config/ # Configuration files
│ │ └── db.ts # Database configuration
│ ├── errors/ # Custom error classes
│ ├── middleware/ # Custom middleware
│ ├── utils/ # Utility functions
│ └── app.ts # Main application file
├── .gitignore # Git ignore file
├── .prettierrc # Prettier configuration
├── .prettierignore # Prettier ignore file
├── eslint.config.mjs # ESLint configuration
├── package.json # NPM package configuration
├── tsconfig.json # TypeScript configuration
└── README.md # Project documentation
```
## Contributing
Feel free to fork this repository and make your own changes. Pull requests are welcome!
## License
This project is licensed under the **ISC License.**
> Thank you for reading and happy *express*-ing! 👾