{"id":19032854,"url":"https://github.com/nomadsdev/auth-jwt-express-mysql","last_synced_at":"2026-03-05T20:44:26.236Z","repository":{"id":254946385,"uuid":"821113137","full_name":"nomadsdev/auth-jwt-express-mysql","owner":"nomadsdev","description":"Webshop Demo is a basic ecommerce application built with Express.js and MySQL for user, product, and stock management, as well as JWT authentication and settings management.","archived":false,"fork":false,"pushed_at":"2024-08-27T03:25:16.000Z","size":26,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-03T03:41:02.073Z","etag":null,"topics":["api","authentication","env","express","jsonwebtoken","mysql","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nomadsdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-06-27T20:55:18.000Z","updated_at":"2024-09-02T06:16:15.000Z","dependencies_parsed_at":"2024-08-27T04:50:36.585Z","dependency_job_id":null,"html_url":"https://github.com/nomadsdev/auth-jwt-express-mysql","commit_stats":null,"previous_names":["nomadsdev/auth-jwt-express-mysql"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nomadsdev/auth-jwt-express-mysql","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nomadsdev%2Fauth-jwt-express-mysql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nomadsdev%2Fauth-jwt-express-mysql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nomadsdev%2Fauth-jwt-express-mysql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nomadsdev%2Fauth-jwt-express-mysql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nomadsdev","download_url":"https://codeload.github.com/nomadsdev/auth-jwt-express-mysql/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nomadsdev%2Fauth-jwt-express-mysql/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30149837,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-05T16:58:46.102Z","status":"ssl_error","status_checked_at":"2026-03-05T16:58:45.706Z","response_time":93,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","authentication","env","express","jsonwebtoken","mysql","nodejs"],"created_at":"2024-11-08T21:32:07.809Z","updated_at":"2026-03-05T20:44:26.200Z","avatar_url":"https://github.com/nomadsdev.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Authentication API \n \nThis is a simple authentication API built with Express.js, MySQL, and JWT. It provides endpoints for user registration and login, including password hashing and token creation. \n \n## Features \n- User registration \n- User login \n- Password hashing using bcrypt \n- Token creation with JWT \n- MySQL database integration \n \n## Getting Started \n \n### Prerequisites \n \n- Node.js \n- MySQL \n- dotenv package for environment variables \n \n### Installation \n \n1. **Clone the repository:** \n \n   ```bash \n   git clone https://github.com/yourusername/your-repository.git \n   ``` \n \n2. **Navigate into the project directory:** \n \n   ```bash \n   cd your-repository \n   ``` \n \n3. **Install dependencies:** \n \n   ```bash \n   npm install \n   ``` \n \n4. **Set up environment variables:** \n \n   Create a `.env` file in the root directory of the project and add the following variables: \n \n   ```env \n   DB_HOST=your_database_host \n   DB_USER=your_database_user \n   DB_PASS=your_database_password \n   DB_DATA=your_database_name \n   KEY_AUTH=your_jwt_secret_key \n   ``` \n \n5. **Start the server:** \n \n   ```bash \n   npm start \n   ``` \n \n   The server will be running on `http://localhost:3000`. \n \n## API Endpoints \n \n### Register \n \n- **URL:** `/api/register` \n- **Method:** `POST` \n- **Request Body:** \n \n   ```json \n   { \n     \"username\": \"user123\", \n     \"email\": \"user@example.com\", \n     \"password\": \"password123\" \n   } \n   ``` \n \n- **Responses:** \n \n - **201 Created** \n \n   ```json \n   { \n     \"token\": \"your_jwt_token\" \n   } \n   ``` \n \n - **400 Bad Request** \n \n   ```json \n   { \n     \"error\": \"Please provide username, email, and password\" \n   } \n   ``` \n \n - **409 Conflict** \n \n   ```json \n   { \n     \"error\": \"User with this email or username already exists\" \n   } \n   ``` \n \n### Login \n \n- **URL:** `/api/login` \n- **Method:** `POST` \n- **Request Body:** \n \n   ```json \n   { \n     \"emailOrUsername\": \"user@example.com\", \n     \"password\": \"password123\" \n   } \n   ``` \n \n- **Responses:** \n \n - **200 OK** \n \n   ```json \n   { \n     \"token\": \"your_jwt_token\", \n     \"message\": \"success\" \n   } \n   ``` \n \n - **400 Bad Request** \n \n   ```json \n   { \n     \"error\": \"Please provide email or username and password\" \n   } \n   ``` \n \n - **401 Unauthorized** \n \n   ```json \n   { \n     \"error\": \"Invalid email/username or password\" \n   } \n   ``` \n \n## Database Schema \n \nEnsure your MySQL database has the following table: \n \n   ```sql \n   CREATE TABLE users ( \n       id INT AUTO_INCREMENT PRIMARY KEY, \n       username VARCHAR(255) UNIQUE NOT NULL, \n       email VARCHAR(255) UNIQUE NOT NULL, \n       password VARCHAR(255) NOT NULL \n   ); \n   ``` \n \n## Contributing \nFeel free to open an issue or submit a pull request if you have suggestions or improvements. \n \n## License \nThis project is licensed under the MIT License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnomadsdev%2Fauth-jwt-express-mysql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnomadsdev%2Fauth-jwt-express-mysql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnomadsdev%2Fauth-jwt-express-mysql/lists"}