Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/adevinwild/micro-express
Opinionated micro Express.js template to build robust REST APIs.
https://github.com/adevinwild/micro-express
awilix boilerplate demo example express-js jest micro-express nodemon nodemon-express postgres postgresql repository-pattern robust template typeorm typescript winston
Last synced: about 1 month ago
JSON representation
Opinionated micro Express.js template to build robust REST APIs.
- Host: GitHub
- URL: https://github.com/adevinwild/micro-express
- Owner: adevinwild
- Created: 2023-09-14T20:51:00.000Z (about 1 year ago)
- Default Branch: develop
- Last Pushed: 2023-09-22T06:56:32.000Z (about 1 year ago)
- Last Synced: 2023-09-27T06:07:06.318Z (about 1 year ago)
- Topics: awilix, boilerplate, demo, example, express-js, jest, micro-express, nodemon, nodemon-express, postgres, postgresql, repository-pattern, robust, template, typeorm, typescript, winston
- Language: TypeScript
- Homepage:
- Size: 124 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
ΞΌExpress
Oppinionated micro Express.js template to build robust REST APIs.ΞΌExpress is a streamlined Express.js template tailored for crafting robust REST APIs. With a curated set of tools and libraries, it accelerates development while offering flexibility for project-specific adjustments.
## π Highlights
- **TypeScript Integration**: Benefit from static type checking and enhanced code intelligence.
- **Code Quality**: Enforced with ESLint and Prettier.
- **Express.js**: Utilizing the minimalist and fast Express.js framework.
- **Rich Logging**: With Winston.
- **CORS Ready**: Using the CORS middleware.
- **Request Parsing**: Via Body Parser.
- **Database & ORM**: TypeORM with Postgres support, containerized with Docker.
- **Testing**: Dependency injection with Awilix and testing via Jest.## π Project Structure
```bash
src/
βββ api/ # API endpoints, middlewares, and routes.
β βββ middlewares/
β βββ routes/
βββ loaders/ # Global logic: API routes, middlewares, DB, and Awilix container.
βββ migrations/ # Database migrations.
βββ models/ # TypeORM entities.
βββ repositories/ # Data access layers.
βββ services/ # Business logic.
βββ types/ # TypeScript type definitions.
βββ utils/ # Utility functions.
```## π Getting Started
#### 1. Clone :
```bash
git clone https://github.com/adevinwild/micro-express.git
```#### 2. Install Dependencies:
```
npm install
```#### 3. Database Setup:
> For this demo, we have already one migration file that creates a `dummy` table with an `id` column.
- Start with Docker :
```bash
docker-compose up --build
```- Apply migrations :
```bash
npm run migration:up
```#### 4. Run Application:
- Development :
```bash
npm run dev
```- Production :
```bash
npm run build && npm start
```## π οΈ Scripts Overview
- `build`: Transpile TypeScript code.
- `start`: Launch the built application.
- `dev`: Development server with nodemon.
- `format`: Beautify code with ESLint & Prettier.
- `lint`: Check code quality with ESLint.
- `test`: Execute tests using Jest.## Happy coding! π