Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/asiff00/api-demo
This project is an API Key Manager application developed using Node.js, Express, and MongoDB. I created this demo project to practice API creation, handling, and Docker management as part of my web application development training.
https://github.com/asiff00/api-demo
api api-client docker docker-compose dockerfile express expressapi expressjs javascript jws mongodb webapi webapp
Last synced: 27 days ago
JSON representation
This project is an API Key Manager application developed using Node.js, Express, and MongoDB. I created this demo project to practice API creation, handling, and Docker management as part of my web application development training.
- Host: GitHub
- URL: https://github.com/asiff00/api-demo
- Owner: asiff00
- License: mit
- Created: 2024-08-27T18:49:10.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2024-08-27T19:26:27.000Z (2 months ago)
- Last Synced: 2024-10-11T04:01:27.466Z (27 days ago)
- Topics: api, api-client, docker, docker-compose, dockerfile, express, expressapi, expressjs, javascript, jws, mongodb, webapi, webapp
- Language: JavaScript
- Homepage:
- Size: 119 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ๐ API Key Manager ๐
This project is an API Key Manager application developed using Node.js, Express, and MongoDB. I created this demo project to practice API creation, handling, and Docker management as part of my web application development training. To maximize your learning, I recommend creating a new project and typing each script yourself. Simply copying and pasting won't be as effective. Just being honest here.
## ๐ It covers:
* ๐ Sign up and log in.
* ๐๏ธ Generate API keys.
* ๐ View their API keys and usage logs.
* โ๏ธ Use their API keys to access a sample `/multiply` endpoint.## ๐ธ Screenshots ๐ธ
**Login Page:**
![Login Page](public/media/login.png)
**Dashboard:**
![Dashboard](public/media/dashboard.png)
## โจ Features โจ
* **๐ User Authentication:** Secure user signup and login with password hashing.
* **๐ API Key Generation:** Generates unique API keys for each user.
* **๐๏ธ API Key Management:** Users can view and manage their generated API keys.
* **๐ Usage Logs:** Tracks API calls made with each API key.
* **๐งช Sample API Endpoint:** Provides a `/multiply` endpoint that demonstrates API key usage.
* **๐ณ Dockerized:** Easy setup and deployment with Docker and Docker Compose.## ๐ Getting Started ๐
### ๐ Prerequisites ๐
* ๐ณ Docker
* ๐ณ Docker Compose### โฌ๏ธ Installation โฌ๏ธ
1. Clone the repo: `git clone https://github.com/your-username/api-key-manager.git`
2. Navigate to the directory: `cd api-key-manager`
3. Run: `docker-compose up -d`### โถ๏ธ Usage โถ๏ธ
1. Access the app: `http://localhost:3000`.
2. Sign up or log in.
3. Generate API keys and view usage logs on the dashboard.
4. Use your API keys to access the `/multiply` endpoint.## ๐ป API Endpoints ๐ป
* **`/auth/signup` (POST):** Creates a new user account.
* **`/auth/login` (POST):** Logs in an existing user.
* **`/api/create-api-key` (POST):** Generates a new API key.
* **`/api/user-data` (GET):** Retrieves API keys and usage logs.
* **`/multiply` (POST):** Multiplies two numbers (requires API key).๐ Project Structure
```
api-key-manager/
โ
โโโ src/
โ โโโ config/
โ โ โโโ database.js # ๐๏ธ Database connection configuration
โ โ
โ โโโ controllers/
โ โ โโโ authController.js # ๐ User authentication logic
โ โ โโโ apiKeyController.js # ๐๏ธ API key management logic
โ โ โโโ multiplyController.js # ๐งช Sample API endpoint logic
โ โ
โ โโโ middleware/
โ โ โโโ auth.js # ๐ Authentication middleware
โ โ
โ โโโ models/
โ โ โโโ User.js # ๐ง User model
โ โ
โ โโโ routes/
โ โ โโโ authRoutes.js # ๐ช Authentication routes
โ โ โโโ apiKeyRoutes.js # ๐๏ธ API key management routes
โ โ โโโ multiplyRoutes.js # ๐งช Sample API endpoint route
โ โ
โ โโโ app.js # โ๏ธ Main application file
โ
โโโ public/
โ โโโ css/
โ โ โโโ styles.css # ๐จ Stylesheets
โ โ
โ โโโ js/
โ โ โโโ main.js # ๐ฅ๏ธ Client-side JavaScript
โ โ
โ โโโ index.html # ๐ Main HTML file
โ
โโโ .dockerignore
โโโ .gitignore
โโโ Dockerfile # ๐ณ Dockerfile for building the application image
โโโ docker-compose.yml # ๐ณ Docker Compose configuration
โโโ package.json # ๐ฆ Project dependencies
โโโ README.md # ๐ This file
```## ๐ Contributing ๐
Contributions are welcome! Please open issues and pull requests.
## ๐ License ๐
This project is licensed under the MIT License.