Flatmates is a platform that lets users search and list flatmates/roommates across multiple cities. Users can add, delete, bookmark and track listings, search by city or location, and apply filters for better discovery. The app supports paid featured listings for higher visibility, secure user authentication and stripe checkout to add featured listing (which ranks on top of search results), fast search with pagination, and a smooth, mobile-friendly experience designed for real-world use.
-
π Authentication & Authorization
- Email/password signup & login
- JWT + HTTPβonly cookies for secure sessions
-
ποΈ Listings & Discovery
- Create, update, and delete room/flat listings
- Fields like location, city, rent, accommodation type, gender preference, facilities, contact info
- Dedicated listing details page with contact CTAs (call / email)
- Popular cities quickβselect section to jump into search
-
β Featured Listings & Payments
- Upgrade a listing to βFeaturedβ via Stripe Checkout
- Stripe webhook marks listing as
isFeatured: trueafter successful payment - Transaction documents stored in MongoDB and linked to the user (
myTransactions)
-
π Bookmarks & User Dashboard
- Bookmark/unbookmark listings and persist them in the user document
- My Listings: manage all listings created by the loggedβin user
- My Bookmarks: view saved listings
- Transaction History: list of successful payments with a modern skeleton/empty state
-
π¨ Modern UI / UX
- Next.js App Router with client components for interactive flows
- Tailwind CSS for a clean, responsive UI
- Toast feedback (success/error) with reactβhotβtoast
- Loading shimmers, empty states, and minimalist success/cancel pages for payments
| Layer | Technologies |
|---|---|
| Frontend | Next.js (App Router), React, TypeScript, Tailwind CSS, Axios, Redux Toolkit |
| Backend | Node.js, Express.js, TypeScript/JavaScript, Stripe SDK, Mongoose |
| Database | MongoDB (Atlas in production ) |
| Other | JWT, bcrypt, reactβhotβtoast, Cloudinary (for images) |
FLATMATES
βββ backend
β βββ dist
β βββ node_modules
β βββ src
β βββ .env
β βββ .gitignore
β βββ package.json
β βββ package-lock.json
β βββ tsconfig.json
β
βββ frontend
β βββ .next
β βββ node_modules
β βββ public
β βββ src
β β βββ app
β β βββ components
β β βββ redux
β β βββ utils
β β βββ middleware.ts
β βββ .env.local
β βββ .gitignore
β βββ globals.d.ts
β βββ next-env.d.ts
β βββ next.config.ts
β βββ postcss.config.mjs
β βββ tsconfig.json
β βββ package.json
β βββ package-lock.json
β βββ pnpm-lock.yaml
β
βββ readme.md
- Node.js (22+ recommended)
- npm or pnpm
- MongoDB instance (local or MongoDB Atlas)
- Stripe account + API keys
- Cloudinary account for image hosting + API keys
git clone https://github.com/sushilkrg/flatmates.git
cd flatmates
Inside your backend directory (e.g. `backend/`):
cd backend
npm install
Create a .env file:
PORT=5000
MONGODB_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret
STRIPE_SECRET_KEY=your_stripe_secret_key
STRIPE_WEBHOOK_SECRET=your_stripe_webhook_secret
CLIENT_URL=http://localhost:3000
for image hosting
CLOUDINARY_CLOUD_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_cloudinary_key
CLOUDINARY_API_SECRET=your_cloudinary_secret
Run the backend in dev mode:
npm run build
npm run start
Inside your Next.js client directory (e.g. frontend/):
cd frontend
pnpm install
Create .env.local:
NEXT_PUBLIC_API_BASE_URL=http://localhost:5000
Run the dev server:
pnpm dev
fullName,email,password- Arrays:
myListings: ObjectId[]β Listings created by the usermyBookmarkedListings: ObjectId[]β Saved listingsmyTransactions: ObjectId[]β Related Stripe transactions
role: "user" | "admin"
location,cityName,rent,accommodationType,lookingForGenderfacilities: string[]contactNumber,contactEmail,postedByName,userIdisFeatured: booleancreatedAt,updatedAt
userId,listingIdamount,status(e.g.success,failed,pending)stripeSessionId,paymentIntentId- Timestamps for history views
- User clicks βFeature this listingβ.
- Frontend calls backend to create a Stripe Checkout Session.
- User pays on Stripeβs hosted page.
- Stripe sends a webhook to
/api/v1/transaction/webhook. - Backend:
- Verifies the event with
stripe.webhooks.constructEvent. - On
checkout.session.completed:- Sets
Listing.isFeatured = true. - Creates a
Transactiondocument. - Pushes the transaction
_idintoUser.myTransactions.
- Sets
- Verifies the event with
Adjust paths/verbs to match your actual Express routes.
POST /api/v1/auth/registerβ RegisterPOST /api/v1/auth/loginβ LoginPOST /api/v1/auth/logoutβ Logout / clear cookies
GET /api/v1/listing/searchβ Search/filter listingsGET /api/v1/listing/details/:idβ Get a single listingPOST /api/v1/listingβ Create listingPATCH /api/v1/listing/:idβ Update listingDELETE /api/v1/listing/:idβ Delete listingPATCH /api/v1/listing/bookmark/:idβ Toggle bookmarkGET /api/v1/listing/my-listingsβ Listings owned by current userGET /api/v1/listing/my-bookmarked-listingsβ Listings bookmarked by current user
POST /api/v1/transaction/create-checkout-sessionβ Stripe Checkout SessionPOST /api/v1/transaction/webhookβ Stripe webhookGET /api/v1/transaction/my-transactionsβ Auth userβs transaction history
- Use Postman to test backend routes.
- Protect webhook route from bodyβparsing conflicts (Stripe expects raw body).
- Keep
.envfiles out of version control.
Contributions, issues, and feature requests are welcome.
- Fork the repository
- Create your feature branch:
git checkout -b feature/new-feature - Commit your changes:
git commit -m "Add new feature" - Push to the branch:
git push origin feature/new-feature - Open a Pull Request
This project is licensed under the MIT License. See the LICENSE file for details (or add one if not present yet).
Sushil Kumar
GitHub: @sushilkrg
If this project helps you, consider β starring the repo!