Simple url shortener service with statistics for authenticated users.
- Set up a instance of the PostgreSQL database. For example the Vercel postgres has a free tier.
- Set up
.env.localfile:- POSTGRES_URL=(PostgreSQL connection string)
- TOKEN_SECRET=(Secret for token signature)
- Run:
pnpm install
pnpm devThe application will start listening on port 3000.
The project is using classic Next.js app router structure with src folder. Pages are utilizing Server components and Server actions whenever possible.
/public- Web root assets/src- Source code./app- Next.js app router root, following mandatory app router structure.- Folders
./**/_componentsinclude route scoped components.
- Folders
./components- Shared UI components./server- Server logic decoupled from Next.js frontend and backend./db- Db connection, client and models./utils- Server internal utils./methods- Front facing methods containing business logic
./lib./server- Bindings to server logics (/src/server/methods)./actions- Next.js server actions
./middleware.ts- Next.js middleware handling protected routes

