How pastemyst/pastemyst-v3 works
Project type and purpose
• This is a full-stack, open-source paste-sharing platform (“Pastemyst v3”), consisting of:
• A SvelteKit client (rich web UI, SSR/SPA)
• An ASP.NET Core Web API (REST endpoints, background jobs, OAuth)
• A MongoDB database
• A small CLI/documentation service and migrator
• Docker Compose orchestration
File structure
• Top-level directories:
• api/ – C# ASP.NET Core project (PasteMyst.Web), plus a Migrator project and unit tests
• client/ – SvelteKit application with components, routes, services, assets
• docs/ – Docusaurus-based documentation site
• compose.yml – Docker Compose definition tying together api, client, db, guesslang, etc.
• api/PasteMyst.Web:
• Controllers (HTTP endpoints), Middleware, Models (DTOs), Services (business logic, data access), Jobs (scheduled cleanup), Extensions, Utils
• Program.cs / Startup pipeline
• client/src:
• Routes (+page, +layout for SSR), lib/ (reusable components, API wrappers), static assets, configuration
• CI/CD: .github/workflows for build, test, doc deploy
README for additional insights
• API: ASP.NET Core, MongoDB, JWT, OAuth (GitHub/GitLab), Guesslang-bun for language autodetect
• Client: Node/NPM, env variables, dev server
• Docker: Entire stack launch via docker-compose
Main components and interactions
a. Frontend (SvelteKit client)
b. Backend API (ASP.NET Core)
c. Database (MongoDB)
d. External services:
• OAuth providers (GitHub, GitLab)
• guesslang-bun executable (language detection)
e. Supporting processes:
• Background jobs (expiration of pastes/tokens)
• Migrator (one-off DB migration utility)
• Documentation site (Docs)
Relationships and data flows
• Client → API: HTTP(S) REST calls to endpoints (PasteController, AuthController, etc.)
• API → MongoDB: CRUD operations via MongoService
• API → OAuth providers: OAuth code flow for login
• API → guesslang-bun: spawn process for language detection
• Jobs (ExpirePastesJob, ExpireAccessTokensJob) run within API container
• Migrator: CLI tool run manually or in CI, reads API config, writes to DB
• Docker Compose wires client, api, MongoDB, guesslang, optionally migrator
Architectural patterns & design principles
• Layered architecture in API: Controllers → Services → Data Access
• Middleware pipeline: Exception handling, encryption, user context
• Dependency injection for services/providers
• SvelteKit file-based routing & SSR
• Containerization & 12-factor app (env-based config, secrets via user-secrets or .env)
Technologies and frameworks
• Frontend: SvelteKit, Vite, TypeScript
• Backend: .NET 7+ (ASP.NET Core), C#, JWT, MongoDB
• CI/CD: GitHub Actions
• Containerization: Docker, Docker Compose
• Docs: Docusaurus