A rigoruous SvelteKit backend implementing Domain-Driven Design (DDD) for cryptocurrency investment analysis. Validated with extensive unit tests and end-to-end testing pipelines.
| Development | Testing | Deployment |
|---|---|---|
| Pre-commit hooks (Husky) | Unit API Tests (Vitest) | Docker containers |
| Code formatting (Prettier) | Service Tests (Vitest) | GitHub Actions CI/CD |
| Linting (ESLint) | E2E tests (Playwright) | Health monitoring |
| Hot reload (Vite) | 100% Type Safety | Graceful shutdown |
| Architecture | Security | Data | Performance |
|---|---|---|---|
| Domain-Driven Design | Rate Limiting | Prisma ORM | Serverless Ready |
| Repository Pattern | Security Headers (CSP) | SQLite / PostgreSQL | Stage-based CI |
| Service Layers | Zod Validation | Data Normalization | Optimized Docker |
We follow a strict DDD layering within the SvelteKit lib/server directory.
src/
├── lib/
│ └── server/
│ ├── domain/ # Enterprise business rules
│ │ ├── schemas/ # Zod contract validation
│ │ ├── entities/ # Pure domain entities (Calculation logic)
│ │ └── errors/ # Custom domain error hierarchy
│ ├── application/ # Application business rules
│ │ └── services/ # Use-case orchestrators
│ └── infrastructure/ # Interface adapters
│ ├── repositories/ # Database access (Prisma)
│ ├── database/ # DB Connection (Singleton)
│ └── api/ # External API clients (Kraken Client)
├── routes/
│ ├── api/
│ │ └── process_request/ # API Gateway / Controller
│ ├── health/ # Health monitoring
│ └── ready/ # Readiness monitoring
└── tests/ # Playwright E2E Tests
git clone <repository-url>
cd ashes-project-backend-sveltekit
npm install
Review .env.example (if available) and ensure database connection (defaults to local SQLite for dev).
npm run test # Run Unit Tests
npm run test:e2e # Run E2E Tests
npm run dev
The API will be available at: http://localhost:5173
We use a pyramid testing strategy.
| Type | Tool | Command | Purpose |
|---|---|---|---|
| Unit | Vitest | npm run test |
Fast feedback on Services & Logic |
| Coverage | Vitest | npm run test:coverage |
Ensure code paths are tested |
| E2E | Playwright | npm run test:e2e |
Verify full request implementation |
We utilize a rigorous GitHub Actions pipeline (pipeline.yml) for continuous integration and delivery.
npm audit on every push.prod/v* tags, including automatic GitHub Release generation.| Endpoint | Purpose | Response |
|---|---|---|
/health |
Basic application health | Status: UP, Uptime, Version |
/ready |
Readiness check (DB) | Status: READY, DB Connection |
GET /api/process_requestAnalyzes cryptocurrency investment over time.
Parameters:
symbol (string, required): Crypto symbol (e.g., BTC, ETH).investment (number, required): Initial investment amount in USD.Response (JSON):
{
"result": {
"symbol": "BTC",
"investment": 1000,
"numberOfCoins": 0.05,
"profit": 500,
"growthFactor": 0.5,
"lambos": 0.002
},
"graph_data": [
{ "x": "2020-01-01T00:00:00.000Z", "y": 7000 },
...
]
}
feature/my-feature.MIT