Skip to content

Commit a250d96

Browse files
author
yedidyar
committed
add VitePress
1 parent 3b3d1d4 commit a250d96

File tree

6 files changed

+1539
-21
lines changed

6 files changed

+1539
-21
lines changed

.github/workflows/deploy.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Sample workflow for building and deploying a VitePress site to GitHub Pages
2+
#
3+
name: Deploy VitePress site to Pages
4+
5+
on:
6+
# Runs on pushes targeting the default branch
7+
push:
8+
branches: [main]
9+
# Allows you to run this workflow manually from the Actions tab
10+
workflow_dispatch:
11+
12+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
13+
permissions:
14+
contents: read
15+
pages: write
16+
id-token: write
17+
18+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
19+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
20+
concurrency:
21+
group: pages
22+
cancel-in-progress: false
23+
24+
jobs:
25+
# Build job
26+
build:
27+
runs-on: ubuntu-latest
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v4
31+
with:
32+
fetch-depth: 0 # Not needed if lastUpdated is not enabled
33+
34+
- name: Setup pnpm
35+
uses: pnpm/action-setup@v4
36+
with:
37+
version: 9
38+
39+
- name: Setup Node
40+
uses: actions/setup-node@v4
41+
with:
42+
node-version: 20
43+
cache: pnpm
44+
45+
- name: Setup Pages
46+
uses: actions/configure-pages@v4
47+
48+
- name: Install dependencies
49+
run: pnpm install --frozen-lockfile
50+
51+
- name: Build with VitePress
52+
run: pnpm docs:build
53+
54+
- name: Upload artifact
55+
uses: actions/upload-pages-artifact@v3
56+
with:
57+
path: docs/.vitepress/dist
58+
59+
# Deployment job
60+
deploy:
61+
environment:
62+
name: github-pages
63+
url: ${{ steps.deployment.outputs.page_url }}
64+
needs: build
65+
runs-on: ubuntu-latest
66+
name: Deploy
67+
steps:
68+
- name: Deploy to GitHub Pages
69+
id: deployment
70+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@ chunk*
55
metadata
66
storage
77
.DS_Store
8-
*.env
8+
*.env
9+
docs/.vitepress/dist
10+
docs/.vitepress/cache

docs/.vitepress/config.mts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { defineConfig } from "vitepress";
2+
3+
// https://vitepress.dev/reference/site-config
4+
export default defineConfig({
5+
title: "Backend Rebase Documentation",
6+
description:
7+
"Technical documentation for the Backend Rebase project - a comprehensive backend rebase project",
8+
base: "/backend-rebase/",
9+
themeConfig: {
10+
nav: [{ text: "Home", link: "/" }],
11+
12+
sidebar: [
13+
{
14+
text: "Project Overview",
15+
items: [{ text: "Introduction", link: "/README" }],
16+
},
17+
],
18+
19+
socialLinks: [
20+
{ icon: "github", link: "https://github.com/yedidyar/backend-rebase" },
21+
],
22+
},
23+
24+
ignoreDeadLinks: [(url) => url.includes("http://localhost")],
25+
});

docs/index.md

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
---
2+
layout: home
3+
4+
hero:
5+
name: "Backend Rebase"
6+
text: "Distributed Systems & Backend Services"
7+
tagline: "A comprehensive backend project featuring distributed systems, microservices, and data structures implementations"
8+
9+
actions:
10+
- theme: brand
11+
text: View on GitHub
12+
link: https://github.com/yedidyar/backend-rebase
13+
14+
features:
15+
- icon: 🌐
16+
title: Distributed System
17+
details: Complete distributed blob storage system with load balancer, cache proxy, and multiple HTTP blob servers with consistent hashing
18+
- icon: 📊
19+
title: Analytics Platform
20+
details: Real-time analytics service with PostgreSQL integration, page view tracking, and materialized views for reporting
21+
- icon: 👥
22+
title: User Management
23+
details: Fastify-based user service with PostgreSQL, soft deletes, and comprehensive logging with Logzio integration
24+
- icon: 🚀
25+
title: Microservices Architecture
26+
details: Multiple independent services with Docker containerization, service discovery, and automated deployment scripts
27+
- icon: 🔧
28+
title: Data Structures
29+
details: Custom implementations of HashMap, LRU Cache, and large-scale sorting algorithms for educational purposes
30+
- icon:
31+
title: Performance Optimized
32+
details: Async/await patterns, worker threads for CPU-intensive tasks, and efficient caching strategies
33+
---
34+
35+
## Quick Start
36+
37+
Get up and running with the entire distributed system in just a few commands:
38+
39+
```bash
40+
# Clone the repository
41+
git clone https://github.com/your-username/backend-rebase.git
42+
cd backend-rebase
43+
44+
# Install dependencies
45+
pnpm install
46+
47+
# Start all services
48+
chmod +x start-services.sh
49+
pnpm run malic:up
50+
```
51+
52+
## Architecture Overview
53+
54+
The project consists of several independent services that work together:
55+
56+
### 🌐 Distributed System Project
57+
58+
- **Load Balancer**: Routes requests using consistent hashing
59+
- **HTTP Blob Server**: Stores and retrieves binary data with metadata
60+
- **Cache Proxy**: LRU cache implementation for improved performance
61+
62+
### 📊 Analytics Project
63+
64+
- **Analytics Service**: Tracks page views and user interactions
65+
- **Increments Service**: Handles real-time data increments
66+
- **PostgreSQL Integration**: With Flyway migrations and materialized views
67+
68+
### 👥 User Service
69+
70+
- **User Management**: CRUD operations with soft delete support
71+
- **PostgreSQL Database**: Connection pooling and transaction management
72+
- **Structured Logging**: Winston with Logzio integration
73+
74+
## Key Features
75+
76+
### 🔄 Service Discovery & Load Balancing
77+
78+
The load balancer automatically discovers and routes traffic to available blob servers using MD5 hashing for consistent distribution.
79+
80+
### 📈 Real-time Analytics
81+
82+
Track page views with hourly granularity, featuring materialized views for efficient reporting and data aggregation.
83+
84+
### 🗄️ Blob Storage System
85+
86+
Store and retrieve binary data with custom metadata, featuring configurable storage limits and folder organization.
87+
88+
### 🚀 Containerized Deployment
89+
90+
Full Docker Compose setup with service orchestration, networking, and environment configuration.
91+
92+
## Educational Components
93+
94+
### 📚 Lesson 01: Data Structures
95+
96+
- Custom HashMap implementation with collision handling
97+
- Large-scale external sorting algorithm using heap-based merge
98+
- Comprehensive test coverage with Vitest
99+
100+
### 📚 Lesson 02: Concurrent Programming
101+
102+
- Synchronous vs asynchronous prime number counting
103+
- Worker threads for CPU-intensive tasks
104+
- Performance benchmarking and optimization
105+
106+
## Technology Stack
107+
108+
- **Runtime**: Node.js v23+ with TypeScript
109+
- **Web Framework**: Fastify for high-performance APIs
110+
- **Database**: PostgreSQL with connection pooling
111+
- **Caching**: Custom LRU cache implementation
112+
- **Logging**: Winston with Logzio integration
113+
- **Testing**: Vitest for unit and integration tests
114+
- **Containerization**: Docker and Docker Compose
115+
- **Package Management**: pnpm for efficient dependency management
116+
117+
<!-- Or dive into specific topics:
118+
119+
- [Distributed Systems](/distributed-system-project/README)
120+
- [Analytics Platform](/analytics-project/README)
121+
- [User Management](/user-service/README)
122+
- [Data Structures](/data-structures/README) -->

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
"cache-proxy:dev": "node --env-file=.env --watch distributed-system-project/cache-proxy/index.ts",
1717
"cache-proxy:prod": "node --env-file=.env distributed-system-project/cache-proxy/index.ts",
1818
"malic:up": "./start-services.sh",
19+
"docs:dev": "vitepress dev docs",
20+
"docs:build": "vitepress build docs",
21+
"docs:preview": "vitepress preview docs",
1922
"format": "prettier . --write"
2023
},
2124
"keywords": [],
@@ -39,6 +42,7 @@
3942
"pino-pretty": "^13.0.0",
4043
"tsx": "^4.19.4",
4144
"typescript": "^5.8.3",
42-
"vitest": "^3.1.3"
45+
"vitest": "^3.1.3",
46+
"vitepress": "^1.6.3"
4347
}
4448
}

0 commit comments

Comments
 (0)