{"id":17345013,"url":"https://github.com/marcel-msc/auth-server","last_synced_at":"2026-05-15T13:01:59.748Z","repository":{"id":234807085,"uuid":"748259353","full_name":"Marcel-MSC/auth-server","owner":"Marcel-MSC","description":"Nodejs sever to learn how to use jsonwebtoken, authentication a user and to create, delete and update user information","archived":false,"fork":false,"pushed_at":"2026-04-06T21:59:12.000Z","size":1053,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-06T23:25:31.454Z","etag":null,"topics":["bcryptjs","cors","dotenv","express","jsonwebtoken","lowdb"],"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/Marcel-MSC.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-01-25T15:55:13.000Z","updated_at":"2026-04-06T21:59:08.000Z","dependencies_parsed_at":"2025-06-17T12:31:44.226Z","dependency_job_id":"3548284a-6b61-44bb-9737-68ef19373df1","html_url":"https://github.com/Marcel-MSC/auth-server","commit_stats":null,"previous_names":["marcel-msc/auth-server"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Marcel-MSC/auth-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Marcel-MSC%2Fauth-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Marcel-MSC%2Fauth-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Marcel-MSC%2Fauth-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Marcel-MSC%2Fauth-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Marcel-MSC","download_url":"https://codeload.github.com/Marcel-MSC/auth-server/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Marcel-MSC%2Fauth-server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33067476,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-15T11:35:32.926Z","status":"ssl_error","status_checked_at":"2026-05-15T11:35:31.362Z","response_time":103,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["bcryptjs","cors","dotenv","express","jsonwebtoken","lowdb"],"created_at":"2024-10-15T16:28:36.523Z","updated_at":"2026-05-15T13:01:59.743Z","avatar_url":"https://github.com/Marcel-MSC.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"\" rel=\"noopener\"\u003e\n \u003cimg width=200px height=200px src=\"./imageReadme/logo.jpg\" alt=\"Project logo\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003ch3 align=\"center\"\u003eauth-server\u003c/h3\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n[![Status](https://img.shields.io/badge/status-active-success.svg)]()\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](/LICENSE)\n\n\u003c/div\u003e\n\n---\n\n\u003cp align=\"center\"\u003eA simple auth server for learning JWT, server-side authentication, user creation, token verification, and account (email) checks.\n    \u003cbr\u003e\n\u003c/p\u003e\n\n## 📝 Table of Contents\n\n- [About](#about)\n- [Getting Started](#getting_started)\n- [Environment](#environment)\n- [API](#api)\n- [Usage](#usage)\n- [Authors](#authors)\n- [Implementation log](#implementation_log)\n\n## 🧐 About \u003ca name = \"about\"\u003e\u003c/a\u003e\n\nThis project uses **Express**, **jsonwebtoken**, **bcryptjs**, **cors**, and **lowdb** to provide a minimal auth API that can:\n\n- Create users (email + password, hashed with bcrypt)\n- Authenticate users and issue JWTs (7-day expiry)\n- Verify JWT tokens via standard `Authorization: Bearer \u003ctoken\u003e` header\n- Check if an account (email) exists\n- Remove users\n\nTokens expire after 7 days. The server validates `JWT_SECRET_KEY` at startup and will not start without it.\n\n## 🏁 Getting Started \u003ca name = \"getting_started\"\u003e\u003c/a\u003e\n\n### Prerequisites\n\n- Node.js (ES modules)\n- npm\n\n### Installing\n\n```bash\ngit clone \u003crepository-url\u003e\ncd auth-server\nnpm i\n```\n\n### Running\n\n1. Copy the environment template and set your JWT secret:\n\n   ```bash\n   cp .env.example .env\n   ```\n\n   Edit `.env` and set `JWT_SECRET_KEY` to a long, random string.\n\n2. Start the server:\n\n   ```bash\n   npm run dev\n   ```\n\n   By default the server listens on port **3080**. You can override with the `PORT` environment variable (e.g. `PORT=3000 npm run dev`).\n\n## Environment \u003ca name = \"environment\"\u003e\u003c/a\u003e\n\n| Variable         | Required | Description                                      |\n|------------------|----------|--------------------------------------------------|\n| `JWT_SECRET_KEY` | Yes      | Secret used to sign and verify JWT tokens.       |\n| `PORT`           | No       | Port to listen on. Default: `3080`.             |\n\nUse `.env.example` as a template; never commit `.env` or real secrets.\n\n## API \u003ca name = \"api\"\u003e\u003c/a\u003e\n\nBase URL: `http://localhost:3080` (or your `PORT`).\n\n| Method | Endpoint           | Description                          |\n|--------|--------------------|--------------------------------------|\n| GET    | `/`                | API documentation (HTML).            |\n| POST   | `/create-user`     | Create user (body: `email`, `password`). |\n| POST   | `/auth`            | Login (body: `email`, `password`). Returns `token`. |\n| POST   | `/verify`          | Verify JWT. Header: `Authorization: Bearer \u003ctoken\u003e`. |\n| GET    | `/check-account`   | Check if email exists. Query: `?email=...`. |\n| DELETE | `/remove-user`     | Remove user. Body: `{ \"email\": \"...\" }`. |\n\n- **Verify** requires the standard header: `Authorization: Bearer \u003cyour-jwt-token\u003e`.\n- **check-account** uses a query parameter: `GET /check-account?email=user@example.com`.\n\nFull endpoint details are also shown on `GET /` in the browser.\n\n## 🎈 Usage \u003ca name=\"usage\"\u003e\u003c/a\u003e\n\nUse this auth server for user authentication in your apps. You can call it as an API from any client (e.g. Insomnia, Postman, or your frontend). Create users with `/create-user`, log in with `/auth` to get a JWT, then send that token in the `Authorization: Bearer \u003ctoken\u003e` header when calling `/verify` or other protected flows.\n\n## ✍️ Authors \u003ca name = \"authors\"\u003e\u003c/a\u003e\n\n- [@Marcel-MSC](https://github.com/Marcel-MSC) - Idea \u0026 Initial work\n\n## 📄 Implementation log \u003ca name = \"implementation_log\"\u003e\u003c/a\u003e\n\nFor a detailed log of recent improvements (JWT expiry, env validation, Bearer token, query params, `.env.example`, etc.), see [docs/IMPLEMENTATION.md](docs/IMPLEMENTATION.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcel-msc%2Fauth-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarcel-msc%2Fauth-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcel-msc%2Fauth-server/lists"}