CasaStudente is a full-featured student housing marketplace built for the University of Bologna's Forlì campus. It connects students searching for accommodation with verified landlords, offering secure payments, AI-powered search, roommate matching, and multilingual support (IT/EN/ES/FR).
Status: MVP with 70+ features, 24 Prisma models, 137 unit tests, and full E2E coverage.
| Category | Features |
|---|---|
| Core | Listing browser with filters & map, listing detail pages, neighborhood guides |
| Auth & Security | bcrypt password hashing, session cookies, CSRF tokens, role-based access (student / landlord / admin), university verification |
| Payments | Stripe Connect marketplace (checkout, subscriptions, refunds), platform fees, payment receipts |
| Messaging | Conversation threads per listing, real-time unread counts, AI-powered message translation |
| AI | Natural language search (OpenAI), listing description generator, multilingual chat assistant |
| Roommates | Profile-based matching with compatibility algorithm (budget, sleep, cleanliness, social, language) |
| Reviews & Trust | 5-dimension ratings, verified-lease badges, trust score with bronze/silver/gold tiers |
| Notifications | In-app + email (Resend), saved search alerts, notification hub with preference management |
| Leases & Documents | Digital lease contracts (transitorio, 4+4, 3+2), tax regime support (cedolare secca), document vault |
| Admin | User management, content moderation, analytics dashboard, telemetry viewer |
| Advanced | Tenant scoring, insurance policies, dispute resolution, housing groups, tour bookings, market forecasting |
| Moonshots | Guaranteed rent, co-living pods, digital twin apartments, student housing passport, resilience fund, arrival concierge |
| Infra | Sentry error tracking, PostHog analytics, Vercel Blob file storage, PWA offline support, i18n (4 languages) |
| Layer | Technology |
|---|---|
| Framework | Next.js 16 (App Router, Server Components, Server Actions) |
| Language | TypeScript 5 |
| UI | React 19, Tailwind CSS 4, Lucide icons, CVA (class-variance-authority) |
| Database | PostgreSQL via Prisma 7 (24 models) + InMemoryStore fallback for dev |
| Auth | bcrypt (cost 12), cookie-based sessions, CSRF protection |
| Payments | Stripe Connect (Express accounts, Checkout, Subscriptions, Webhooks) |
| AI | OpenAI GPT-4o-mini (search parsing, description generation, chat, translation) |
| Resend (verification, receipts, notifications) | |
| Storage | Vercel Blob (listing photos, documents, evidence) |
| Monitoring | Sentry (errors) + PostHog (product analytics) |
| Testing | Vitest (unit) + Playwright (E2E) |
| Deployment | Vercel |
- Node.js β₯ 18
- npm β₯ 9
- PostgreSQL (optional β the app falls back to in-memory stores for development)
# Clone the repository
git clone <repository-url>
cd casa-studente
# Install dependencies
npm install
# Copy environment variables
cp .env.example .env
# Edit .env with your API keys (all external services are optional for local dev)
# Generate Prisma client
npm run db:generate
# Run the development server
npm run devOpen http://localhost:3000 to view the app.
The app seeds demo users automatically (in-memory mode):
| Role | Password | |
|---|---|---|
| Student | martina.lopez@studio.unibo.it |
password123 |
| Student | luca.bianchi@studio.unibo.it |
password123 |
| Landlord | elena.rossi@casastudente.it |
password123 |
| Admin | admin@casastudente.it |
admin123 |
casa-studente/
βββ prisma/
β βββ schema.prisma # 24 models, full relational schema
β βββ seed.ts # Database seeding script
βββ src/
β βββ app/ # Next.js App Router pages & API routes
β β βββ api/ # REST API endpoints
β β β βββ auth/ # Authentication (logout)
β β β βββ health/ # Health check
β β β βββ institutional/ # Public data APIs (rents, vacancy, forecasts)
β β β βββ landlord/ # Landlord-specific APIs
β β β βββ listings/ # Listing CRUD
β β β βββ moonshots/ # Experimental features
β β β βββ upload/ # File upload
β β β βββ webhooks/ # Stripe webhooks
β β βββ admin/ # Admin dashboard pages
β β βββ auth/ # Login, register, verify pages
β β βββ dashboard/ # User dashboard (30+ sub-pages)
β β βββ listings/ # Listing browse & detail
β β βββ neighborhoods/ # Zone guides + quiz
β β βββ ... # Community, calendar, roommates, etc.
β βββ components/ # 22 React components
β βββ generated/ # Prisma-generated client
β βββ lib/ # Core business logic
β β βββ actions/ # 29 Server Action modules
β β βββ repositories/ # 10 data access repositories
β β βββ services/ # 7 external service integrations
β β βββ stores/ # 25 in-memory domain stores
β β βββ auth.ts # Authentication logic
β β βββ db.ts # InMemoryStore base class
β β βββ i18n.ts # Internationalization (4 languages)
β β βββ password.ts # bcrypt hashing + legacy migration
β β βββ rate-limit.ts # In-memory rate limiter
β β βββ utils.ts # Tailwind class utilities
β β βββ validation.ts # Zod schemas for all inputs
β βββ middleware.ts # Security headers, CSP, route protection
βββ tests/unit/ # 9 test suites, 137 test cases
βββ e2e/ # Playwright E2E specs
βββ package.json
# Run all unit tests
npm test
# Watch mode
npm run test:watch
# Coverage report
npm run test:coverage
# E2E tests (requires dev server running)
npm run test:e2e
# Type checking
npm run typecheck
# Linting
npm run lint| Suite | Tests | Covers |
|---|---|---|
db.test.ts |
10 | InMemoryStore CRUD, filtering, seeding |
password.test.ts |
14 | bcrypt hashing, legacy format migration, CSRF tokens |
validation.test.ts |
23 | Zod schemas (listings, payments, reviews, messages, AI) |
stores.test.ts |
16 | Domain stores (conversations, reviews, payments, notifications) |
features.test.ts |
19 | Compatibility algorithm, trust scoring, distance calculations |
i18n.test.ts |
18 | Translation keys, locale detection, formatting |
rate-limit.test.ts |
15 | Rate limiting with window expiration |
ai-service.test.ts |
14 | NL search fallback, description generation, chat |
moonshots.test.ts |
8 | Experimental feature stores |
| Command | Description |
|---|---|
npm run dev |
Start development server |
npm run build |
Production build |
npm start |
Start production server |
npm run lint |
Run ESLint |
npm test |
Run unit tests (Vitest) |
npm run test:e2e |
Run E2E tests (Playwright) |
npm run typecheck |
TypeScript type checking |
npm run db:generate |
Generate Prisma client |
npm run db:migrate |
Run database migrations |
npm run db:push |
Push schema to database |
npm run db:seed |
Seed database |
npm run db:studio |
Open Prisma Studio |
See .env.example for all available variables. All external services are optional β the app provides graceful fallbacks:
| Variable | Service | Required? |
|---|---|---|
DATABASE_URL |
PostgreSQL | No (uses InMemoryStore) |
STRIPE_SECRET_KEY |
Stripe payments | No (mock mode) |
RESEND_API_KEY |
Email delivery | No (console logging) |
OPENAI_API_KEY |
AI features | No (template fallback) |
BLOB_READ_WRITE_TOKEN |
File storage | No (mock URLs) |
SENTRY_DSN |
Error tracking | No (console only) |
POSTHOG_API_KEY |
Product analytics | No (console only) |
- API Reference β Complete REST API & Server Actions documentation
- Architecture β System architecture with Mermaid diagrams
The app is configured for Vercel deployment:
# Build for production
npm run build
# Or deploy via Vercel CLI
npx vercelRequired Vercel settings:
- Framework Preset: Next.js
- Build Command:
npm run build - Output Directory:
.next - Environment Variables: Set all required keys in the Vercel dashboard
Source code is publicly available. No open-source license has been selected yet.