Skip to content

Latest commit

 

History

10 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Descrição da imagem

Getting Started

Prerequisites

  • Node.js (v20+)
  • PostgreSQL
  • Redis

Installation

  1. Clone the repository:
git clone https://github.com/Samudomingos/brev.ly.git
cd brevly
  1. Install dependencies:
# Install server dependencies
cd server
pnpm install

# Install web dependencies
cd ../web
pnpm install
  1. Configure environment variables:

Server (.env file in server/ directory):

# Database
DATABASE_URL=postgresql://postgres:docker@host.docker.internal:5432/brevly
REDIS_URL=redis://host.docker.internal:6379

# Cloudflare
CLOUDFLARE_ACCOUNT_ID=your_account_id
CLOUDFLARE_PUBLIC_URL=your_public_url
AWS_ACCESS_KEY_ID=your_access_key
AWS_SECRET_ACCESS_KEY=your_secret_key
AWS_BUCKET_NAME=your_bucket_name

Web (.env file in web/ directory):

VITE_API_URL=http://localhost:3333
  1. Start the database (using Docker):
cd server
docker-compose up -d
  1. Run migrations:
cd server
pnpm prisma generate
pnpm prisma migrate deploy
  1. Start the development servers:

Server:

cd server
pnpm dev

Web:

cd web
pnpm dev
  1. Access the application:

API Endpoints

  • POST /links - Create a new shortened URL
  • POST /links/exports - Export links to CSV
  • GET /links - Get all links
  • GET /links/:shortUrl - Access Link by Short Url
  • DELETE /links/:linkId - Delete a link

Deployment

Frontend

Build and run the frontend application:

cd web
pnpm build
pnpm start

Backend

Build and run the backend application:

cd server
pnpm build
pnpm start:prod

Docker

The server includes a Dockerfile for containerized deployment:

cd server
docker build -t brevly-server .
docker run -p 3333:3333 --env-file .env brevly-server

About

FTR Rocketseat Challenge

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages