A lightweight messaging app built with the following tech stack:
- Next.js App Router
- React (client and server components)
- tRPC (type-safe API between client and server)
- Prisma + SQLite
- Tailwind CSS
- shadcn/ui
- Server actions for authentication flow
This project implements the expected following functionality:
- Users can sign in with a username and password
- A simple flow for creating an account is available from the login page
- Users see a list of their message threads
- Users can start a new thread with any existing user
- Each thread shows messages in chronological order
- The newest message always appears at the bottom
- Messages update automatically without refreshing the page (via polling)
- The README includes steps on how to run the project locally
- The app provides a built-in seed mechanism to generate demo users
In the project root, create an .env file with the following content:
DATABASE_URL="file:./db.sqlite"
NEXT_PUBLIC_HOST_URL="http://localhost:3000"This points Prisma to a local SQLite database file (db.sqlite), which Prisma will create automatically.
Without this file, running npm install will fail with a Prisma initialization error.
Once .env exists, install dependencies:
npm installAfter installing dependencies, setup the local database:
npm run db:pushThis creates a local SQLite database (db.sqlite) based on the Prisma schemas.
For development:
npm run devFor preview mode:
npm run previewThe app will be available at:
http://localhost:3000
There is no CLI seeding required.
You can seed users from the login page:
- Open
http://localhost:3000 - Press “Seed 8 demo users”
- Eight demo users will be created, all with password
12345
alice / 12345
bob / 12345
charlie / 12345
diana / 12345
eric / 12345
… and a few more
A good way to test exchanging messages between 2 users:
- Visit start page and click the button "Seed 8 demo users"
- Log in as Alice (or with your own account) in your main browser
- Start a thread with Bob
- Open an incognito window
- Log in as Bob
- Exchange messages between the two windows
This demonstrates threads, participants, and polling-based live message updates.
Used to quickly deliver both the frontend and backend in one project. Since this was a time-boxed assignment, the built-in server components, file-based routing and server actions helped move faster.
Covers the required frontend stack and enables quick UI iteration with strict typing
Used purely for speed. It provides accessible and pre-styled components that work well with App Router, letting me focus on the features rather than styling.
Chosen to satisfy the requirement for an end-to-end type-safe API between backend and frontend. tRPC removes API schema duplication, speeds up iteration and provides excellent developer experience for small to medium services.
The assignment requires an RDBMS, and SQLite is the most lightweight database that requires no infrastructure, no Docker and no external services. I think it's great for a local-only demo. In real deployments I would pick Postgres.
Good developer experience for modeling relational data quickly. Also made the seeding simple
The requirements ask for new messages to appear without refreshing the page. Polling is pragmatic for this assignment because it avoids the additional infrastructure needed for WebSockets in App Router (which I attempted at first and abandoned after figuring out that it would require more than 5 hours... 😅). It still delivers a responsive experience.