source-code/
portofolio-backend
Public
codeCodeinfoIssues 0call_splitPull Requestsplay_circleActions
andreyyste
andreyystedocs(backend): add JSDoc annotations to GithubSyncService sync process
ed69f8815 hours agohistory15 Commits
folderprisma
chore/config: add DIRECT_URL, GITHUB_TOKEN, and GITHUB_USERNAME to env example
1 day ago
foldersrc
fix(github): resolve lint errors in GithubSyncService
3 days ago
foldertest
fix(github): resolve lint errors in GithubSyncService
3 days ago
description.env.example
feat/auth: enforce JWT secret validation without NODE_ENV check
1 day ago
description.gitignore
refactor(backend): extract GithubFileProxyService for file/tree operations
15 hours ago
description.portfolio.json
chore/format: format codebase with prettier
1 day ago
description.prettierrc
feat/auth: enforce JWT secret validation without NODE_ENV check
1 day ago
refactor(backend): introduce IGithubApiService interface and implement in GithubApiService
15 hours ago
descriptionnest-cli.json
chore/config: add DIRECT_URL, GITHUB_TOKEN, and GITHUB_USERNAME to env example
1 day ago
feat/auth: enforce JWT secret validation without NODE_ENV check
1 day ago
descriptionpackage.json
refactor(backend): introduce IGithubApiService interface and implement in GithubApiService
15 hours ago
descriptionProcfile
refactor(backend): register new services in GithubModule
15 hours ago
descriptionREADME.md
chore/format: format codebase with prettier
1 day ago
docs(backend): add detailed JSDoc documentation to PortfolioService CRUD operations
15 hours ago
descriptiontsconfig.json
refactor(portfolio): annotate handlePrismaError with strict never return type
3 days ago
README.md

Portfolio Backend

The robust, neo-brutalist engine powering dynamic portfolio content.

NestJS TypeScript Prisma SQLite

<hr>

Overview

Welcome to the dedicated backend for the Neo-Brutalist portfolio. Built from the ground up, this API serves dynamic, easily updatable content directly to the Next.js frontend. It effectively decouples portfolio presentation from content management, giving you the flexibility to update your projects, skills, and experiences seamlessly.

Production Deployments


Features at a Glance

  • Robust Architecture: Powered by NestJS, utilizing a scalable structure of modules, controllers, and services.
  • Database Mastery: Utilizes Prisma ORM for safe and typed database queries (SQLite for dev, PostgreSQL-ready for prod).
  • Automated GitHub Synchronization: Auto-syncs public repositories on startup and every 24 hours (midnight cron). Reads repository file trees, READMEs, and custom .portfolio.json configs to automatically populate/hide projects. Includes a manual trigger endpoint (POST /github/sync).
  • Memory Cache Management: Integrates caching for GitHub API calls to prevent rate limiting and optimize loading of file structures in the browser codebase explorer.
  • Selective Validation Pipes: Uses whitelisting override options ({ whitelist: false }) on configuration controllers to allow unstructured nested JSON configurations.
  • Comprehensive REST API: Full CRUD operations available for your entire portfolio ecosystem:
    • Projects
    • Experiences
    • Skills
    • Global Configurations (JSON key-value stores)
  • Ironclad Security:
    • JWT Authentication: Protects sensitive POST, PATCH, and DELETE endpoints.
    • Argon2 Hashing: Next-generation password hashing for maximum safety.
    • Data Validation: Strict payload validation using NestJS ValidationPipe.
    • Helmet Integration: Enforces secure HTTP headers.
  • Frontend Ready: Pre-configured CORS securely accepts requests from http://localhost:3000.

Detailed Feature Breakdown

🔄 Automated GitHub Synchronization

  • Metadata Syncing: Fetches public repositories from the GitHub API using dynamic authorization headers. If a repository contains a .portfolio.json metadata file, the project is parsed and upserted into the database.
  • Conditional Project Visibility: If a repository doesn't have a .portfolio.json or has "include": false, the backend automatically soft-deletes the project from the dashboard view by setting hidden: true.
  • API Endpoints:
    • POST /github/sync — Admin-only endpoint to trigger a manual, immediate synchronization of all repositories.

💾 In-Memory Cache Manager

  • Rate-Limit Prevention: Integrates NestJS @nestjs/cache-manager to cache repository file structures, directories, and markdown readme contents fetched from GitHub.
  • Cached Endpoints:
    • GET /github/repos/:repoName/tree
    • GET /github/repos/:repoName/file
    • GET /github/repos/:repoName/readme
    • GET /github/repos/:repoName/metadata

🛡️ CMS Configuration Pipelines

  • Nested Object Validation: Overrides NestJS's default global ValidationPipe whitelisting behaviour on the /config/:key controller to prevent stripping of nested JSON keys. This allows structured key-value configuration values (such as marquee arrays, social lists, and nav routes) to pass validation untouched.
  • CRUD API Guards: All state-modifying endpoints (POST, PATCH, DELETE) are guarded by Passport's JwtStrategy ensuring only authenticated administrators can mutate database records.

Tech Stack

| Category | Technology | | :--- | :--- | | Framework | NestJS | | Language | TypeScript | | Database | SQLite (Dev) / PostgreSQL (Prod) | | ORM | Prisma ORM | | Security | Passport.js, JWT, Argon2, Helmet |


Getting Started

Prerequisites

Ensure you have Node.js installed on your machine.

Installation

Clone the repository and install the necessary dependencies:

git clone https://github.com/andreyyste/portofolio-backend
cd portofolio-backend
npm install

Environment Configuration

Create a .env file in the root directory and configure your secrets:

JWT_SECRET="your-super-secret-key"
DATABASE_URL="file:./dev.db"

Database Setup

Run Prisma migrations to construct the schema, then seed the database with initial data:

npx prisma migrate dev
npx prisma db seed

Running the Server

Start up the API server in your preferred mode:

# Development mode (Hot-reload)
npm run start:dev

# Production mode
npm run build
npm run start:prod

The API will be available locally at http://localhost:3001


API Endpoints Reference

Public Routes (Read-Only)

  • GET /portfolio/projects — Fetch all projects & tags.
  • GET /portfolio/experiences — Fetch all work/educational experiences.
  • GET /portfolio/skills — Fetch all skills.
  • GET /config/:key — Fetch singleton UI configurations (heroData, aboutData, etc.).

Protected Routes (Requires JWT Token)

  • POST /auth/login — Authenticate and receive an access token.
  • POST, PATCH, DELETE — Available on /portfolio/* and /config/* routes for authorized admins.

Built with standard practices for a seamless, dynamic portfolio experience.

warningDESIGN PHILOSOPHY
  • Containment: Every element lives within a rigid bounding box. No floating content.
  • Contrast: High contrast borders (#1e1b19) are mandatory. 3px standard, 6px heavy.
  • Depth: Hard solid shadows. No blur. Physical displacement on interaction.

LIVE PRODUCTION DEMO

Experience the rigid geometry in real-time.

REBEL

About

Fullstack portfolio backend built with NestJS, Prisma, and PostgreSQL. Features JWT authentication, throttler rate limits, cache management, and automated GitHub repository synchronization.

TypeScriptNestJSPostgreSQLPrisma

Contributors

1