What it is
Skill Swap is a small social network for trading skills. Each user lists skills they know and skills they want to learn. Users browse each other's profiles, send connection requests, and chat with file attachments. It is a full-stack Next.js project on top of PostgreSQL.
How it works
The app uses the Next.js App Router. Server components read from the database through Prisma, and server actions handle every write. The app has no separate REST API except one file-download route.
| Area | Behavior | Where |
|---|---|---|
| Accounts | Username and password sign-up and login, with sessions stored in the database | app/login, lib/auth.ts |
| Home | A table of every other user with their known and wanted skills | app/components/UsersTable.tsx |
| Profile | Edit the profile picture, about text, and both skill lists | app/profile |
| Other profiles | View a user and send, cancel, or accept a connection request | app/view-profile/[userId], app/profile/components |
| Chat | Send text and one file per message, and download received files | app/chat/[withUserId], app/api/downloadFile |
The Prisma schema (prisma/schema.prisma) models the domain with these tables:
Userholds the credentials, profile fields, and a self-relation nameduserConnections.ConnectionRequestuses the sender and receiver IDs as a composite key. A user can send at most one request to another user.Skill,KnownSkillOfUser, andWantedSkillOfUserstore each skill name once and link users to it.Messagestores the text, the sender and receiver, and an optional file name and file bytes.
Design decisions
Polling instead of WebSockets for chat. The chat window calls a server action every second and asks for messages newer than the last one it holds. The app deploys to Vercel, so polling likely avoids running a separate socket server (this is an inference from the setup, not a stated reason). It needs no extra infrastructure. The cost is a steady stream of requests and up to one second of delay. The code also shows that the first version used a route handler, which a later commit replaced with server actions.
Files stored in PostgreSQL. An attachment is a Bytes column on the Message row, so one database holds all state and no object store is needed. Message queries use Prisma's omit option to leave the file column out, so loading a conversation never pulls file contents. The download route fetches the bytes for one message on demand. Large files would strain this design.
Database sessions with Lucia and argon2. Passwords are hashed with @node-rs/argon2, and Lucia stores sessions through the Prisma adapter. The commit history notes that Turbopack was avoided because of argon2 problems, and next.config.mjs lists the package under serverExternalPackages.
Accepting a request in one transaction. Accepting a connection deletes the request and connects the two users in a single $transaction. The two changes succeed or fail together, so a request never survives its own acceptance.
Partial prerendering. next.config.mjs enables experimental.ppr. Pages render a static shell and wrap data-dependent parts in Suspense with skeleton fallbacks. Cached user data uses unstable_cache with a user tag, which a profile update revalidates.
Run it locally
You need Node.js 20 and a PostgreSQL database. The app reads a single environment variable, DATABASE_URL.
-
Clone the repository and install dependencies.
git clone https://github.com/WhyAsh5114/skill-swap.git cd skill-swap npm install -
Create a
.envfile in the project root.DATABASE_URL=postgresql://username:password@localhost:5432/skillswap -
Apply the migrations.
npx prisma migrate dev -
Start the dev server and open
http://localhost:3000.npm run dev
The repository also includes a dev container (.devcontainer/) that starts PostgreSQL 16 and applies the migrations.
Reference
| Area | Choice |
|---|---|
| Framework | Next.js 15 (release candidate at the time of the build), React 19, TypeScript |
| Database | PostgreSQL on Neon, accessed through Prisma 5 |
| Auth | Lucia 3, @node-rs/argon2 |
| UI | Tailwind CSS, shadcn/ui on Radix primitives, next-themes |
| Forms and validation | React Hook Form, Zod |
| Hosting | Vercel |
| CI | GitHub Actions workflow that installs dependencies, generates the Prisma client, and runs migrations against a Postgres service |
Outcome
The repository was created on 2024-09-27. Most of the application was committed between 2024-09-30 and 2024-10-05. A contributor added the dev container, a Makefile, and the CI workflow on 2025-10-26. The repository has 104 commits from two contributors. A deployment is listed at skill-swap-ebon.vercel.app.