2import { readFile, serveFile } from "https://esm.town/v/std/utils@85-main/index.ts";
3import { parseProject } from "https://esm.town/v/std/utils@85-main/index.ts";
4import { runMigrations } from "./database/migrations.ts";
5import { apiRoutes } from "./routes/api.ts";
6
34app.use("*", customCors());
35
36// Run database migrations on startup
37await runMigrations();
38
15```
16โโโ backend/
17โ โโโ database/
18โ โ โโโ migrations.ts # Schema definitions
19โ โ โโโ queries.ts # DB query functions
54- **Code Editor**: Monaco Editor
55- **Backend**: Hono (TypeScript)
56- **Database**: SQLite
57- **C Compilation**: WebAssembly-based C compiler
6
7- `index.ts` - Main entry point for the HTTP trigger
8- `database/` - Database migrations and queries
9- `routes/` - API route handlers
10- `services/` - Business logic services
31- `GET /api/users/:username/progress` - Get learning path with user progress
32
33## Database Schema
34
35The platform uses SQLite for data storage with the following tables:
1import { Exercise } from "../database/queries.ts";
2import { compileAndRunCode } from "./compiler.ts";
3
11 getUserProgress,
12 getLearningPathWithProgress
13} from "../database/queries.ts";
14import { compileAndRunCode } from "../services/compiler.ts";
15import { validateExerciseSolution } from "../services/exercises.ts";
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { parseProject } from "https://esm.town/v/std/utils@85-main/index.ts";
3import { runMigrations } from "./database/migrations.ts";
4import jobRoutes from "./routes/jobs.ts";
5import chatRoutes from "./routes/chat.ts";
28});
29
30// Run database migrations on startup
31app.use("*", async (c, next) => {
32 try {
35 await runMigrations();
36 app.set("migrationsRun", true);
37 console.log("Database migrations completed successfully");
38 }
39 } catch (error) {
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { getChatMessages, createChatMessage } from "../database/queries.ts";
3import { ApiResponse, ChatMessage } from "../../shared/types.ts";
4
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { getAllJobPostings, createJobPosting } from "../database/queries.ts";
3import { ApiResponse, JobPosting } from "../../shared/types.ts";
4
1// Script to set up the telegram_chats table in SQLite
2// Run this script manually to create the database table
3
4export default async function setupTelegramChatDb() {
25 `);
26
27 return "Telegram chat database table created successfully.";
28 } catch (error) {
29 console.error("Error setting up telegram_chats table:", error);
13## Technical Architecture
14
15**โ ๏ธ important caveat: the admin dashboard doesn't have auth! currently it just relies on security by obscurity of people not knowing the url to a private val. this is not very secure. if you fork this project and put sensitive data in a database you should think carefully about how to secure it.**
16
17Stevens has been designed with the utmost simplicity and extensibility, much like a well-organized household. At the heart of his operation lies a single "memories" table - a digital equivalent of a butler's meticulous records. This table serves as the foundation for all of Stevens' operations.
45- `dashboard`: the admin view for showing the memories notebook + visualizing imports
46- `dailyBriefing`: stuff related to sending a daily update via telegram
47- `dbUtils`: little one-off scripts for database stuff
48
49## Hiring your own Stevens
57- For the Google Calendar integration you'll need `GOOGLE_CALENDAR_ACCOUNT_ID` and `GOOGLE_CALENDAR_CALENDAR_ID`. See [these instuctions](https://www.val.town/v/stevekrouse/pipedream) for details.
58
59**important caveat: the admin dashboard doesn't have auth! currently it just relies on security by obscurity of people not knowing the url to a private val. this is not very secure, if you put sensitive data in a database you should think carefully about how to secure it.**
60
61Overall it's a simple enough project that I encourage you to just copy the ideas and run in your own direction rather than try to use it as-is.