Skip to content

Conversation

@MbohBless
Copy link
Owner

No description provided.

…greSQL

Architecture:
- Frontend: Next.js 14 with App Router, TypeScript, Tailwind CSS
- Backend: Kotlin + Ktor REST API with JWT authentication
- Database: PostgreSQL with full-text search and migrations
- Storage: Supabase Storage for files
- CI/CD: GitHub Actions for automated testing and deployment

Features:
- Public pages: Projects, Publications, Blog (with MDX)
- Admin dashboard: CRUD operations for all content types
- Full-text search across all content
- File upload system
- Pagination and view tracking
- Docker Compose for local development
- Complete API with 15+ endpoints
- Production-ready security with JWT auth

Database:
- 6 SQL migration files with proper indexes
- Generated tsvector columns for search
- Automated triggers for timestamps
- Foreign key relationships

Deployment:
- Vercel configuration for frontend
- Render/Docker deployment for backend
- Automated CI/CD workflows
- Environment templates for easy setup
BREAKING CHANGE: Complete architecture rewrite - removed separate backend

## What Changed

**Removed:**
- Entire Kotlin + Ktor backend (backend/ folder)
- Separate API server deployment (Render)
- Backend CI/CD workflow
- SQL migrations workflow

**Added:**
- Prisma ORM with PostgreSQL schema
- Server Actions for mutations (projects, publications, blog)
- API routes for search and file upload
- Direct database access in Server Components
- Authentication middleware for admin routes

## New Architecture

- **Before**: Next.js frontend → Ktor API → PostgreSQL
- **Now**: Next.js (Server Components + Server Actions) → PostgreSQL

## Benefits

1. **Single Codebase**: Monorepo with all code in frontend/
2. **Better Performance**: No API roundtrips, direct DB queries
3. **Simpler Deployment**: One Vercel deployment instead of two
4. **Lower Cost**: $0 on Vercel Free tier vs $25-50/mo
5. **Faster Development**: No context switching between repos

## Migration Guide

1. Database now managed by Prisma:
   - Schema: frontend/prisma/schema.prisma
   - Commands: npm run db:{generate,push,migrate,studio}

2. Mutations use Server Actions:
   - frontend/src/app/actions/{projects,publications,blog}.ts
   - Called directly from forms, no API client needed

3. Pages fetch data directly:
   - import { prisma } from '@/lib/prisma'
   - const data = await prisma.model.findMany()

4. API routes only for external access:
   - GET /api/search - Full-text search
   - POST /api/upload - File upload to Supabase

## Setup Instructions

1. cd frontend && npm install
2. npm run db:push (creates tables)
3. npm run dev
4. Access at http://localhost:3000

See updated README.md for complete documentation.
- Complete rewrite of ARCHITECTURE.md with new patterns and flows
- Simplify docker-compose.yml to PostgreSQL only
- Update Makefile with Prisma commands, remove backend targets
- Simplify root .env.example to reference frontend config
- Comprehensive frontend/README.md with Prisma workflows

All documentation now reflects the monolithic Next.js architecture
using Prisma ORM, Server Components, and Server Actions.
@MbohBless MbohBless self-assigned this Nov 21, 2025
@gitguardian
Copy link

gitguardian bot commented Nov 21, 2025

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
22610672 Triggered Generic Password e1cc713 docker-compose.yml View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

This fixes the GitHub Actions workflow error where npm cache
was failing due to missing package-lock.json file.
- Add clsx and tailwind-merge dependencies for utility functions
- Fix implicit 'any' type errors across all page components
- Add explicit type annotations to map() callbacks
- All components now pass TypeScript strict type checking

Files updated:
- package.json: Added clsx and tailwind-merge
- src/app/api/search/route.ts: Type annotations for map callbacks
- src/app/blog/[slug]/page.tsx: Type annotation for tags
- src/app/blog/page.tsx: Type annotations for posts and tags
- src/app/projects/[slug]/page.tsx: Type annotations for techStack and images
- src/app/projects/page.tsx: Type annotations for projects and techStack
- src/app/publications/page.tsx: Type annotations for reduce and map callbacks
- Move Supabase client initialization to runtime in upload API route
  Previously initialized at module level causing build-time errors
  when environment variables weren't available
- Replace <img> with Next.js <Image> component in project detail page
  Improves performance with automatic image optimization
- Add proper error handling for missing Supabase credentials

This fixes the "supabaseUrl is required" build error in CI/CD.
@vercel
Copy link

vercel bot commented Nov 21, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
portfolio Ready Ready Preview Comment Nov 21, 2025 1:19pm

Change from ISR (revalidate) to fully dynamic rendering for pages
that require database access. This prevents Next.js from trying to
pre-render these pages at build time when the database might not be
accessible (e.g., in CI/CD before database setup).

Pages updated:
- /projects - Changed from revalidate to force-dynamic
- /publications - Changed from revalidate to force-dynamic
- /blog - Changed from revalidate to force-dynamic

This allows the build to complete without database connectivity,
while pages will still fetch fresh data on each request at runtime.
@MbohBless MbohBless merged commit 272142a into main Nov 21, 2025
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants