An open API service indexing awesome lists of open source software.

https://github.com/uthrapathy-m/osm-auth-app

Full-stack login and landing page app using Node.js, MongoDB, Tailwind CSS, and Docker Compose.
https://github.com/uthrapathy-m/osm-auth-app

docker docker-compose docker-image docker-images dockerfile

Last synced: about 2 months ago
JSON representation

Full-stack login and landing page app using Node.js, MongoDB, Tailwind CSS, and Docker Compose.

Awesome Lists containing this project

README

          

Here’s your complete and polished `README.md` for the GitHub repo of your full-stack login + landing page Docker Compose app:

---

### βœ… `README.md`

```markdown
# 🧠 OSM Auth App

A full-stack login + landing page app using:

- βš™οΈ Node.js + Express backend (JWT-based authentication)
- 🎨 Static HTML + Tailwind CSS frontend
- πŸƒ MongoDB for user storage
- 🐳 Docker Compose to run everything easily β€” no local installs required

---

## πŸ“¦ Features

- βœ… User registration and login
- βœ… Password hashing with bcrypt
- βœ… JWT token generation and localStorage-based login
- βœ… Elegant UI styled using TailwindCSS
- βœ… Landing page appears after login
- βœ… Entire app runs with a single Docker Compose command

---
```
## πŸ“ Folder Structure

```

osm-auth-app/
β”œβ”€β”€ backend/ # Node.js Express API (port 5000)
β”œβ”€β”€ frontend/ # Static HTML UI served via npx serve (port 3000)
β”œβ”€β”€ docker-compose.yml # Docker Compose setup
β”œβ”€β”€ .gitignore # Docker Compose setup

````

---

## πŸ› οΈ Tech Stack

| Layer | Technology |
|------------|--------------------|
| Frontend | HTML, TailwindCSS |
| Backend | Node.js, Express |
| Database | MongoDB |
| Auth | JWT, bcrypt |
| DevOps | Docker Compose |

---

## πŸš€ Getting Started

### 1. Clone the Repository

```bash
git clone https://github.com/uthrapathy-m/osm-auth-app.git
cd osm-auth-app
````

---

### 2. Build & Run the App

#### βœ… Recommended: Full Rebuild

```bash
docker-compose up --build -d
```
---

* Reuses volumes and image cache
* Faster for incremental testing

#### βš™οΈ Optional: Clean Build and Start

```bash
docker-compose down -v && docker-compose build --no-cache && docker-compose up -d
```

* Removes all containers, volumes, and cache
* Rebuilds everything fresh
* Starts services in background (detached mode)

---

### 3. Access the Application

| Service | URL |
| -------- | -------------------------------------------------------- |
| Frontend | [http://localhost:3000](http://localhost:3000) |
| Backend | [http://localhost:5000/auth](http://localhost:5000/auth) |
| Database | localhost:27017 (internal via `mongo`) |

---

## πŸ” Auth Flow

1. Users submit a username and password via the login page
2. If it’s a first-time user β†’ auto-register and hash the password
3. If user exists β†’ verify password using bcrypt
4. Issue a JWT token on success
5. Save token in `localStorage` and redirect to `landing.html`

---

## πŸ§ͺ Dev Commands

```bash
# View backend logs
docker-compose logs -f backend

# View all service logs
docker-compose logs -f

# Stop all services
docker-compose down

# Stop and wipe everything
docker-compose down -v
```

---

## ❓ Troubleshooting

### Invalid ELF Header on bcrypt?

If you see:

```
Error: invalid ELF header in bcrypt_lib.node
```

You copied `node_modules` from your host into the container. Fix it:

* Add this to `backend/.dockerignore`:

```
node_modules
```

Then rebuild with:

```bash
docker-compose down -v && docker-compose build --no-cache && docker-compose up -d
```