{"id":18743244,"url":"https://github.com/anthonybudd/express-api-boilerplate","last_synced_at":"2026-03-15T22:13:25.828Z","repository":{"id":50424678,"uuid":"429196713","full_name":"anthonybudd/express-api-boilerplate","owner":"anthonybudd","description":"A very simple REST API boilerplate using Express.js, Sequelize and MySQL.","archived":false,"fork":false,"pushed_at":"2024-06-17T18:27:31.000Z","size":957,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-26T15:43:10.674Z","etag":null,"topics":["api","express","mysql","node","rest","sequelize"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/anthonybudd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-17T20:49:15.000Z","updated_at":"2024-06-17T18:27:35.000Z","dependencies_parsed_at":"2023-01-29T01:46:12.863Z","dependency_job_id":"fdd98cd3-b6e7-453f-84f4-e56f83d006d4","html_url":"https://github.com/anthonybudd/express-api-boilerplate","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anthonybudd%2Fexpress-api-boilerplate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anthonybudd%2Fexpress-api-boilerplate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anthonybudd%2Fexpress-api-boilerplate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anthonybudd%2Fexpress-api-boilerplate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anthonybudd","download_url":"https://codeload.github.com/anthonybudd/express-api-boilerplate/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248635368,"owners_count":21137223,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","express","mysql","node","rest","sequelize"],"created_at":"2024-11-07T16:10:45.533Z","updated_at":"2026-03-15T22:13:25.798Z","avatar_url":"https://github.com/anthonybudd.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Express API Boilerplate\n\n\u003cimg height=\"75\" src=\"https://raw.githubusercontent.com/anthonybudd/anthonybudd/master/img/express-api-boilerplate.png?v=1\"/\u003e\n\n## ⚠️ I have stopped maintaining this repo in favor of the new [TypeScript version](https://github.com/anthonybudd/express-ts-api-boilerplate)\n\nA very mimimal REST API boilerplate using Express.js, Sequelize and MySQL. \n\nThis project is designed to work with [AnthonyBudd/Vuetify-SPA-Boilerplate](https://github.com/anthonybudd/Vuetify-SPA-boilerplate)\n\n\n- 👥 Users, Groups and Roles\n- 🔐 Auth using JWT's with Passport.js\n- 🌐 Production-ready [OpenApiSpec.yml](./OpenApiSpec.yml) \u0026 [Kubernetes files](./k8s)\n- 🥇 Real-world tested, generated over $50M in revenue\n\n\n```sh\ngit clone git@github.com:anthonybudd/express-api-boilerplate.git\ncd express-api-boilerplate\ncp .env.example .env\n\n# Optional: Find \u0026 Replace (case-sensaive, whole repo): \"express-api\" =\u003e \"your-api-name\" \nLC_ALL=C find . -type f -name '*.*' -exec sed -i '' s/express-api/your-api-name/g {} +\n\n# Private RSA key for JWT signing\nopenssl genrsa -out private.pem 2048\nopenssl rsa -in private.pem -outform PEM -pubout -out public.pem\n\n# Start the app\nnpm install\ndocker compose up\nnpm run _db:refresh\nnpm run _test\n\n# Code generation\nnpm run generate -- --model=\"Book\"\nnpm run _test\n\n# Edit models interactivly\nnpm run edit --model=\"User\" --id=\"c4644733-deea-47d8-b35a-86f30ff9618e\"\n```\n\n### DB Structure\nThe DB structure is the optimum balance of functionality and minimalism. A User can belong to many Groups through the GroupsUsers table. This allows you to make very basic single-user applications that do not even require the concept of groups or full SaaS solutions with complex User-Group relationships.\n\n```                                                                \n+--------------+           +---------------+         +--------------+  \n|Users         | --------∈ |GroupsUsers    | ∋------ |Groups        |  \n|--------------|           |---------------|         |--------------|  \n|id            |           |id             |         |id            |  \n|email         |           |groupID        |         |name          |  \n|password      |           |userID         |         |ownerID       |  \n|firstName     |           |createdAt      |         |createdAt     |  \n|lastName      |           +---------------+         |updatedAt     |  \n|createdAt     |                                     +--------------+  \n|updatedAt     |                                                       \n|...           |                                                      \n+--------------+                      \n```\n\n### Routes\n| Method      | Route                                                    | Description                           | Payload                               | Response          | \n| ----------- | -------------------------------------------------------- | ------------------------------------- | ------------------------------------- | ----------------- |  \n| **DevOps**  |                                                          |                                       |                                       |                   |  \n| GET         | `/_readiness`                                            | Kuber readiness check                 | --                                    | \"healthy\"         |  \n| GET         | `/api/v1/_healthcheck`                                   | Returns {status: 'ok'} if healthy     | --                                    | {status: 'ok'}    |  \n| **Auth**    |                                                          |                                       |                                       |                   |  \n| POST        | `/api/v1/auth/login`                                     | Login                                 | {email, password}                     | {accessToken}     |  \n| POST        | `/api/v1/auth/sign-up`                                   | Sign-up                               | {email, password, firstName, tos}     | {accessToken}     |  \n| GET         | `/api/v1/auth/verify-email/:emailVerificationKey`        | Verify Email                          | --                                    | {success: true}   |  \n| POST        | `/api/v1/auth/forgot`                                    | Forgot                                | {email}                               | {success: true}   |  \n| GET         | `/api/v1/auth/get-user-by-reset-key/:passwordResetKey`   | Get user for given `passwordResetKey` | --                                    | {id, email}       |  \n| POST        | `/api/v1/auth/reset`                                     | Reset Password                        | {email, password, passwordResetKey}   | {accessToken}     |  \n| GET         | `/api/v1/auth/get-user-by-invite-key/:inviteKey`         | Get user for given `inviteKey`        | --                                    | {id, email}       |  \n| POST        | `/api/v1/auth/invite`                                    | Complete user invite process          | {inviteKey, email, password, ...}     | {accessToken}     |  \n| GET         | `/api/v1/_authcheck`                                     | Returns {auth: true} if has auth      | --                                    | {auth: true}      |  \n| **Groups**  |                                                          |                                       |                                       |                   |  \n| GET         | `/api/v1/groups/:groupID`                                | Returns group by ID                   | --                                    | {Group}           |  \n| POST        | `/api/v1/groups/:groupID`                                | Update group by ID                    | {name: 'New Name'}                    | {Group}           |  \n| POST        | `/api/v1/groups/:groupID/users/invite`                   | Invite user to group                  | {email}                               | {UserID, GroupID} |  \n| DELETE      | `/api/v1/groups/:groupID/users/:userID`                  | Remove user from group                | --                                    | {UserID}          |  \n| **User**    |                                                          |                                       |                                       |                   |  \n| GET         | `/api/v1/user`                                           | Get the current user                  |                                       | {User}            |  \n| POST        | `/api/v1/user`                                           | Update the current user               | {firstName, lastName}                 | {User}            |  \n| POST        | `/api/v1/user/update-password`                           | Update password                       | {password, newPassword}               | {success: true}   |  \n\n\n### Deployment\nFull Kubernetes deployment instructions can be found in [k8s/Deploy.md](./k8s/Deploy.md).\n\n- [api.deployment.yml](./k8s/api.deployment.yml)\n- [api.service.yml](./k8s/api.service.yml)\n- [api.ingress.yml](./k8s/api.ingress.yml)\n\n```sh\nkubectl apply -f .k8s/api.deployment.yml \\\n  -f .k8s/api.ingress.yml \\\n  -f .k8s/api.service.yml \n```\n\n\n### Code Generation\nThere is a very rudimentary code generation script that will create 5 files for you; a model, router, migration, seeder and a test. Input your model name using the `--modelName` argument as PascalCase or camelCase. Use `-v` for verbose output and `-d` for a dry run.\n\n```sh\nnpm run generate -- --modelName=\"ModelNameAsPascalCase\"\n```\n\n\n### Generate SDK Client Libraries\nThere is an [OpenAPISpec](./OpenApiSpec.yml) in the root of the repo. The project includes code generation config files for PHP, JavaScript and Swift. Use the below command to generate SDK Client Libraries for your API to `/sdk/dist`. A full list of supported langauages [can be found here.](https://github.com/OpenAPITools/openapi-generator?tab=readme-ov-file#overview)\n\n\n```sh\ndocker run --rm \\\n  -v ${PWD}:/app \\\n  -w /app \\\n  openapitools/openapi-generator-cli batch sdk/config/*.yaml\n```\n\n### Commands\nThere are a few helper scripts and commands for interacting with the application.\n\nSome commands need to be run inside the docker container, these commands have been aliased with an underscore prefix, for exmaple `npm run _db:refresh` is an alias for `docker exec -ti express-api npm run db:refresh` which actually runs `./src/scripts/refresh`\n| Command               | Description                   | Exmaple                          | \n| --------------------- | ----------------------------- | -------------------------------- |\n| generate              | Code generation               | `npm run generate -- --model=\"book\"` |\n| get                   | Get a model                   | `npm run get --model=\"User\" --id=\"c4644733-deea-47d8-b35a-86f30ff9618e\"` |\n| edit                  | Interactive model editing     | `npm run edit --model=\"User\" --id=\"c4644733-deea-47d8-b35a-86f30ff9618e\"` |\n| pkg                   | Compile app                   | `npm run pkg` |\n| jwt.js                | Generate JWT for a user       | `docker exec -ti express-api node ./src/scripts/jwt.js --userID=\"c4644733-deea-47d8-b35a-86f30ff9618e\"` |\n| forgotPassword.js     | Generate password reset link  | `docker exec -ti express-api node ./src/scripts/forgotPassword.js --userID=\"c4644733-deea-47d8-b35a-86f30ff9618e\"` |\n| resetPassword.js      | Password user password        | `docker exec -ti express-api node ./src/scripts/resetPassword.js --userID=\"c4644733-deea-47d8-b35a-86f30ff9618e\" --password=\"password\"` |\n| inviteUser.js         | Invite user to group          | `docker exec -ti express-api node ./src/scripts/inviteUser.js --email=\"newuser@example.com\" --groupID=\"fdab7a99-2c38-444b-bcb3-f7cef61c275b\"` |\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanthonybudd%2Fexpress-api-boilerplate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanthonybudd%2Fexpress-api-boilerplate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanthonybudd%2Fexpress-api-boilerplate/lists"}