This is a full-fledged User Authentication app created using Express, TypeORM, Passport, Swagger, MySQL, and Node. This app will give you an overall concept of how authentication works.
Here is the list of APIs this app contains:"
This guide provides step-by-step guide on setting up and running the "mysql-express-node-auth-app" project locally on your machine. Please follow the steps outlined below.
Below is a summary of key features and instructions for running the project:
- Express.js and TypeScript for server-side development.
- TypeORM for database interactions.
- Passport for authentication strategies.
- Swagger for API documentation.
- Nodemon for automatic server restart during development.
- ts-node for running TypeScript files directly.
- Concurrently for running multiple npm scripts concurrently.
- Database Migrations:
TypeORM is used for managing database migrations. Commands for creating, generating, applying, and rolling back migrations are provided.
Before getting started, ensure that you have the following installed on your machine:
- Node.js: Download and Install Node.js
- npm (Node Package Manager): Included with Node.js installation
-
Clone the Repository: Open a terminal and run the following command to clone the project repository:
git clone https://github.com/dev-scripts/mysql-express-node-auth-app.git
-
Navigate to the Project Directory: Change into the project directory using the following command:
cd mysql-express-node-auth-app
-
Install Dependencies: Install project dependencies by running:
npm install
To run the project in development mode with automatic restart on file changes, execute the following command:
npm run dev
This command uses nodemon
to watch for changes in the src
directory and automatically restarts the server.
To start the project in production mode, use:
npm start
To generate Swagger documentation, use the following command:
npm run swagger
This command generates Swagger specs based on your TypeScript code.
The project includes commands for managing database migrations using TypeORM.
-
Create a Migration:
npm run migration:create
-
Generate a Migration:
npm run migration:generate
-
Run Migrations:
npm run migration:up
-
Rollback Migrations:
npm run migration:down
-
Environment Variables: Create a
.env
file in the project root with the necessary environment variables. You can refer to the provided.env.example
file for guidance. -
Swagger UI: Access the Swagger UI at
http://localhost:8000/docs
to interact with the API documentation. -
Concurrent Commands: The
concurrently
package allows you to run multiple npm scripts concurrently. This is utilized in thenpm run dev
command.
Now you should have the "mysql-express-node-auth-app" project up and running locally. If you encounter any issues, please refer to the project documentation or seek assistance from the project's maintainers.
Feel free to customize the content as needed for your specific project.