|
1 | | -# [express-api](https://github.com/masb0ymas/express-api) with Sequelize |
| 1 | +# Express API with Sequelize |
2 | 2 |
|
3 | | -[](https://github.com/masb0ymas/express-api-sequelize#readme) |
4 | | -[](https://github.com/masb0ymas/express-api-sequelize/graphs/commit-activity) |
| 3 | +[](https://github.com/masb0ymas/express-api-sequelize#readme) |
| 4 | +[](https://github.com/masb0ymas/express-api-sequelize/graphs/commit-activity) |
5 | 5 | [](https://github.com/masb0ymas/express-api-sequelize/blob/master/LICENSE.md) |
6 | | - |
7 | | -[](https://github.com/masb0ymas/express-api-sequelize/releases/tag/v6.0.0) |
| 6 | +[](https://github.com/masb0ymas/express-api-sequelize/releases/tag/v6.0.0) |
8 | 7 | [](https://expressjs.com/) |
9 | 8 |  |
10 | 9 |  |
11 | 10 |  |
12 | 11 |  |
13 | 12 |
|
14 | | -## Feature |
| 13 | +A robust Express API template with TypeScript, Sequelize ORM, and comprehensive tooling for building production-ready applications. |
| 14 | +Base API using [express-api](https://github.com/masb0ymas/express-api) |
| 15 | + |
| 16 | +## Features |
| 17 | + |
| 18 | +- **[TypeScript](https://github.com/microsoft/TypeScript)** `5.8.x` - Type-safe JavaScript |
| 19 | +- **[Sequelize](https://github.com/sequelize/sequelize)** `6.x` - Powerful ORM for SQL databases |
| 20 | +- **[Nodemailer](https://github.com/nodemailer/nodemailer)** `6.x` - Email sending made simple |
| 21 | +- **[Handlebars](https://github.com/wycats/handlebars.js)** - HTML templating engine |
| 22 | +- **[Zod](https://github.com/colinhacks/zod)** `3.x` - TypeScript-first schema validation |
| 23 | +- **Code Quality** |
| 24 | + - JavaScript Style with [Standard with TypeScript](https://github.com/standard/eslint-config-standard-with-typescript) |
| 25 | + - Code formatting with [Prettier](https://github.com/prettier/prettier) |
| 26 | + - [ESLint](https://github.com/prettier/eslint-config-prettier) and [TypeScript ESLint](https://github.com/typescript-eslint/typescript-eslint) integration |
| 27 | +- **API Documentation** with [Swagger](https://github.com/swagger-api/swagger-ui) OpenAPI `3.x` |
| 28 | +- **Logging** with [Pino](https://github.com/pinojs/pino) |
| 29 | +- **Git Workflow** with [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/), [Husky](https://github.com/typicode/husky) & [Commitlint](https://github.com/conventional-changelog/commitlint) |
| 30 | +- **Containerization** with Docker |
| 31 | + |
| 32 | +## Module System |
| 33 | + |
| 34 | +- By default, the `main` branch uses ES Modules (`type: module`) |
| 35 | +- For CommonJS, use the `commonjs` branch |
| 36 | + |
| 37 | +## Getting Started |
| 38 | + |
| 39 | +1. **Clone the repository** |
| 40 | + |
| 41 | + ```bash |
| 42 | + git clone https://github.com/masb0ymas/express-api-sequelize.git |
| 43 | + cd express-api-sequelize |
| 44 | + ``` |
| 45 | + |
| 46 | +2. **Set up environment variables** |
| 47 | + |
| 48 | + ```bash |
| 49 | + cp .env.example .env |
| 50 | + ``` |
| 51 | + |
| 52 | + Then configure database settings in the `.env` file |
| 53 | + |
| 54 | +3. **Install dependencies** |
| 55 | + |
| 56 | + ```bash |
| 57 | + yarn install |
| 58 | + ``` |
| 59 | + |
| 60 | +4. **Set up database** |
| 61 | + |
| 62 | + ```bash |
| 63 | + yarn db:create && yarn db:reset |
| 64 | + ``` |
| 65 | + |
| 66 | + Or create your database manually |
| 67 | + |
| 68 | +5. **Start development server** |
| 69 | + |
| 70 | + ```bash |
| 71 | + yarn dev |
| 72 | + ``` |
| 73 | + |
| 74 | + With file watching: |
| 75 | + |
| 76 | + ```bash |
| 77 | + yarn dev:watch |
| 78 | + ``` |
| 79 | + |
| 80 | +6. **Enable Git hooks** |
| 81 | + ```bash |
| 82 | + yarn husky install |
| 83 | + ``` |
| 84 | + |
| 85 | +## Deployment |
15 | 86 |
|
16 | | -- [TypeScript](https://github.com/microsoft/TypeScript) `5.8.x` |
17 | | -- [Sequelize](https://github.com/sequelize/sequelize) `6.x` |
18 | | -- [Nodemailer](https://github.com/nodemailer/nodemailer) `6.x` |
19 | | -- [Handlebars](https://github.com/wycats/handlebars.js) for templating HTML |
20 | | -- [Zod](https://github.com/colinhacks/zod) for validation schema `3.x` |
21 | | -- JavaScript Style [Standard with TypeScript](https://github.com/standard/eslint-config-standard-with-typescript) |
22 | | -- Formating code using [Prettier](https://github.com/prettier/prettier) Integration [Eslint](https://github.com/prettier/eslint-config-prettier) and [TypeScript Eslint](https://github.com/typescript-eslint/typescript-eslint#readme) |
23 | | -- Documentation with [Swagger](https://github.com/swagger-api/swagger-ui) OpenApi `3.x` |
24 | | -- Logger with [Pino](https://github.com/pinojs/pino) |
25 | | -- [Convensional Commit](https://www.conventionalcommits.org/en/v1.0.0/) with [Husky](https://github.com/typicode/husky) & [Commitlint](https://github.com/conventional-changelog/commitlint) |
| 87 | +### Release Process |
26 | 88 |
|
27 | | -## Note |
| 89 | +```bash |
| 90 | +yarn release |
| 91 | +``` |
28 | 92 |
|
29 | | -By Default branch `main` using `type: module`. If you want to use `CommonJS` you must clone the branch `commonjs` |
| 93 | +### Docker Deployment |
30 | 94 |
|
31 | | -## Steps to run this project: |
| 95 | +```bash |
| 96 | +# Build the Docker image |
| 97 | +docker build -t yourname/express:v1.0.0 . |
32 | 98 |
|
33 | | -1. Clone this repository |
34 | | -2. Duplicate `.env.example` to `.env` |
35 | | -3. Setup database settings inside `.env` file |
36 | | -4. Create your database ( manual ) or run `yarn db:create && yarn db:reset` |
37 | | -5. Run `yarn dev` command |
38 | | -6. Run watch command `yarn dev:watch` |
39 | | -7. Enable commitlint with husky `yarn husky install` |
40 | | -8. Release your app for *Production* or *Staging* with `yarn release` |
41 | | -9. Build your code with Docker `docker build -t yourname/express:v1.0.0 .` |
42 | | -10. Run with docker image `docker run -p 7000:8000 -d yourname/express:v1.0.0` |
| 99 | +# Run the container |
| 100 | +docker run -p 7000:8000 -d yourname/express:v1.0.0 |
| 101 | +``` |
43 | 102 |
|
44 | 103 | ## Author |
45 | 104 |
|
46 | 105 | [](https://github.com/masb0ymas) |
47 | 106 | [](https://twitter.com/masb0ymas) |
48 | | -[](https://www.linkedin.com/in/masb0ymas) |
| 107 | +[](https://www.linkedin.com/in/masb0ymas) |
49 | 108 |
|
50 | | -## Support Me |
| 109 | +## Support |
51 | 110 |
|
52 | 111 | [](https://ko-fi.com/I2I03MVAI) |
53 | 112 |
|
|
0 commit comments