A social networking app for connecting meaningfully with close friends and communities.
- Email + PIN Authentication: Secure login with email verification
- Skip PIN on localhost: Development mode allows quick login without PIN verification
- User Profiles: Create and customize your profile with username, full name, and bio
- Groups: Create and join private or public groups
- Followers: Follow friends and mark close relationships
- Updates Feed: Stay informed about new followers and group activities
- Frontend: Next.js 14 with React, TypeScript, and CSS Modules
- Backend: Next.js API routes on the Node.js runtime
- Database: Turso (libSQL) with a custom adapter layer
- Dev Tools: Storybook for component development, Vitest for testing
slowpost/
├── src/
│ ├── app/ # Next.js application routes
│ ├── components/ # Shared React components
│ ├── contexts/ # React context providers
│ ├── lib/ # Frontend utilities and API client
│ ├── server/ # Server logic reused by API routes
│ └── shared/ # Shared TypeScript types
├── tests/server/ # Vitest suites covering server logic
├── docs/ # Documentation
└── scripts/ # Tooling helpers (e.g. deploy to Vercel)
- Node.js 18+
- Yarn
- Install dependencies:
yarn install-
Configure a development database (see Development database setup).
-
Start the development server:
yarn dev- Client & API: http://localhost:3000 (API mounted at
/api)
By default, the server runs with SKIP_PIN=true, which means:
- You can click "Skip PIN (localhost only)" button to bypass PIN verification
- PINs are logged to the console for testing
- This mode is only available in development
The development entrypoint (yarn dev) loads .env.development.local (falling back to .env.development, .env.local, or .env) before starting Next.js. It exits early if the required Turso variables are missing so you always run against the same database that production code expects.
- Install the Turso CLI and sign in:
turso auth signup # or: turso auth login - Create a development database (feel free to choose a different name):
turso db create slowpost-dev
- Generate a read/write auth token for that database:
Copy the resulting token.
turso db tokens create slowpost-dev --read-write
- Grab the libsql connection URL:
turso db show slowpost-dev --url
- Create
.env.development.localin the project root with the values you collected:You can also include any other environment variables you need for local testing. TheTURSO_URL=libsql://slowpost-dev-<hash>.turso.io TURSO_AUTH_TOKEN=<the token from step 3> SKIP_PIN=trueyarn devscript automatically loads this file. - Run
yarn devand visit http://localhost:3000.
- Open http://localhost:3000
- Click "Get Started" or "Log In | Sign Up"
- Enter your email address
- Since this is a new account, you'll be asked to create your profile
- Enter a username and full name
- In development mode, click "Skip PIN" or enter the PIN shown in the yellow box
- You're now logged in!
- Go to http://localhost:3000/login
- Enter your email
- Click "Skip PIN" in development mode
- You're logged in!
The app uses a clean adapter pattern for database operations:
getDocument(collection, key)- Retrieve a single documentaddDocument(collection, key, data)- Create a new documentupdateDocument(collection, key, update)- Update existing documentgetChildLinks(collection, parentKey)- Get all children in a relationshipgetParentLinks(collection, childKey)- Get all parents in a relationshipaddLink(collection, parentKey, childKey, data)- Create a relationship
This abstraction makes it easy to swap out the database implementation later if needed.
- User enters email → Server generates 6-digit PIN
- PIN is sent via email (or shown in dev mode)
- User enters PIN → Server verifies and creates session
- Session token stored in httpOnly cookie
- Client checks session on page load via
/api/auth/me
yarn dev- Start the Next.js dev server (client + API)yarn build- Create a production buildyarn start- Run the production serveryarn test- Execute Vitest suitesyarn lint- Run ESLintyarn typecheck- Run TypeScript in no-emit modeyarn storybook- Launch Storybookyarn build-storybook- Build Storybook static assets
Create a .env.local file in the project root to configure server behaviour. Useful keys include:
SKIP_PIN=true
POSTMARK_API_KEY=your_key_here # For production email sending
TURSO_URL=...
TURSO_AUTH_TOKEN=...
The scripts/dev.js helper loads .env.development.local (falling back to the other standard dotenv files) and ensures TURSO_URL/TURSO_AUTH_TOKEN are defined before invoking Next.js. This guarantees both the API layer and web client talk to Turso in development, mirroring production behaviour.
Now that you have a working login system, you can incrementally add:
- Profile Pages: View and edit user profiles
- Groups Feature: Create and manage groups
- Followers System: Follow other users
- Notifications: Real-time updates
- Email Integration: Configure Postmark for real PIN delivery
MIT