2.2 KiB
URL Shortener
A modern, full-stack URL shortener application built with a separate backend and frontend, orchestrated via Docker Compose.
Prerequisites
Before you begin, ensure you have the following installed on your machine:
Configuration
-
Clone the repository:
git clone <repository-url> cd url-shortener -
Environment Setup:
Copy the example environment file to create your local configuration:
cp .env.example .env -
Configure Environment Variables:
Open the
.envfile and adjust the variables as needed. Key variables include:DOMAIN: The base domain for the application (default:localhost).STACK_NAME: The name of the Docker stack (default:url-shortener).JWT_SECRET: A secret key for signing JWTs. Change this to a secure random string.PRISMA_USERNAME&PRISMA_PASSWORD: Credentials for accessing Prisma Studio.- Note:
PRISMA_PASSWORDmust be a bcrypt hash. The example file contains the hash for "adminpassword".
- Note:
Deployment
To start the application in a local development environment, run:
docker compose -f compose.yaml -f compose.local.yaml up -d --build
This command builds the images and starts the services in detached mode.
Accessing the Services
Once the containers are up and running, you can access the various components at the following URLs (assuming default DOMAIN=localhost):
- Frontend (URL Shortener UI): http://short.localhost
- Backend API: http://localhost/api
- Prisma Studio (Database GUI): http://studio.localhost
- Auth required (default: admin / adminpassword)
- Traefik Dashboard: http://traefik.localhost
Project Structure
The project is organized into two main directories, each with its own README for more detailed information:
backend/: Contains the Bun API and database logic.frontend/: Contains the React/Vite frontend application.