brev-ly is a modern and efficient URL shortener developed with a full-stack architecture. It features a monorepo structure containing a Node.js backend and a React frontend.
- URL Shortening: Create short links with random or custom slugs.
- Analytics: Track visits to shortened links.
- Management: List, manage, and delete links.
- Export: Export link data to CSV using database cursors for memory-efficient processing, with the API streaming the output directly to Cloudflare R2.
- API Documentation: RESTful API documented with Swagger.
The project is organized as a monorepo:
server/: Backend API (Node.js/Fastify)web/: Frontend Interface (React/Vite)
-
Runtime & Framework:
- Node.js | Fastify | TypeScript
-
Database & ORM:
-
Validation & Documentation:
-
Storage & Infrastructure:
- AWS SDK S3 (Cloudflare R2 integration) | Docker
-
Tooling:
-
Core:
- React | Vite | TypeScript
-
Routing & State:
-
Styling:
-
UI Components & Utils:
- Node.js >= 18.x
- pnpm >= 10.x
- Docker & Docker Compose
cd server
pnpm install
# Configure Environment
cp .env.example .env
# Edit .env with your credentials
# Start Database
docker-compose up -d db
# Run Migrations
pnpm db:generate
pnpm db:migrate
# Start Dev Server
pnpm devServer runs at http://localhost:3333. Swagger docs at /docs.
cd web
pnpm install
# Configure Environment
cp .env.example .env
# Start Dev Server
pnpm devFrontend runs at http://localhost:5173.
To run the backend and database entirely in Docker:
# update the credentials in docker-compose.yml file
cd server
docker-compose up -dpnpm dev: Development modepnpm build: Build for productionpnpm start: Start production buildpnpm db:studio: Open Drizzle Studio
pnpm dev: Development serverpnpm build: Production buildpnpm preview: Preview production buildpnpm lint: Run ESLint
