Skill Swap

Social platform where users connect, chat, and exchange skills, with file sharing.

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.

AreaBehaviorWhere
AccountsUsername and password sign-up and login, with sessions stored in the databaseapp/login, lib/auth.ts
HomeA table of every other user with their known and wanted skillsapp/components/UsersTable.tsx
ProfileEdit the profile picture, about text, and both skill listsapp/profile
Other profilesView a user and send, cancel, or accept a connection requestapp/view-profile/[userId], app/profile/components
ChatSend text and one file per message, and download received filesapp/chat/[withUserId], app/api/downloadFile

The Prisma schema (prisma/schema.prisma) models the domain with these tables:

  • User holds the credentials, profile fields, and a self-relation named userConnections.
  • ConnectionRequest uses the sender and receiver IDs as a composite key. A user can send at most one request to another user.
  • Skill, KnownSkillOfUser, and WantedSkillOfUser store each skill name once and link users to it.
  • Message stores 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.

  1. Clone the repository and install dependencies.

    git clone https://github.com/WhyAsh5114/skill-swap.git
    cd skill-swap
    npm install
    
  2. Create a .env file in the project root.

    DATABASE_URL=postgresql://username:password@localhost:5432/skillswap
    
  3. Apply the migrations.

    npx prisma migrate dev
    
  4. 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

AreaChoice
FrameworkNext.js 15 (release candidate at the time of the build), React 19, TypeScript
DatabasePostgreSQL on Neon, accessed through Prisma 5
AuthLucia 3, @node-rs/argon2
UITailwind CSS, shadcn/ui on Radix primitives, next-themes
Forms and validationReact Hook Form, Zod
HostingVercel
CIGitHub 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.

Liked Skill Swap? Here's my background.

Full-stack TypeScript, shipped to real users.