Pre-launch — Gluecron is in final validation. Public signups and git hosting for non-owner users open after launch review.
CodeIssuesPull RequestsActionsSecurityInsightsSettings
✨ AI
More
Blame · Line-by-line history

app.tsx

Each line is annotated with the commit that last touched it. Click any SHA to jump to that commit and see the surrounding change.

app.tsxBlame213 lines · 1 contributor
79136bbClaude1import { Hono } from "hono";
2import { logger } from "hono/logger";
3import { cors } from "hono/cors";
05b973eClaude4import { compress } from "hono/compress";
79136bbClaude5import { Layout } from "./views/layout";
3ef4c9dClaude6import { requestContext } from "./middleware/request-context";
7import { rateLimit } from "./middleware/rate-limit";
79136bbClaude8import gitRoutes from "./routes/git";
9import apiRoutes from "./routes/api";
10import authRoutes from "./routes/auth";
11import settingsRoutes from "./routes/settings";
7298a17Claude12import settings2faRoutes from "./routes/settings-2fa";
79136bbClaude13import issueRoutes from "./routes/issues";
14import repoSettings from "./routes/repo-settings";
15import compareRoutes from "./routes/compare";
0074234Claude16import pullRoutes from "./routes/pulls";
17import editorRoutes from "./routes/editor";
c81ab7aClaude18import forkRoutes from "./routes/fork";
19import webhookRoutes from "./routes/webhooks";
20import exploreRoutes from "./routes/explore";
21import tokenRoutes from "./routes/tokens";
43de941Claude22import contributorRoutes from "./routes/contributors";
3ef4c9dClaude23import notificationRoutes from "./routes/notifications";
24import dashboardRoutes from "./routes/dashboard";
25import askRoutes from "./routes/ask";
26import releaseRoutes from "./routes/releases";
27import gateRoutes from "./routes/gates";
28import insightsRoutes from "./routes/insights";
29import searchRoutes from "./routes/search";
30import healthRoutes from "./routes/health";
ad6d4adClaude31import hookRoutes from "./routes/hooks";
6fc53bdClaude32import themeRoutes from "./routes/theme";
33import auditRoutes from "./routes/audit";
34import reactionRoutes from "./routes/reactions";
24cf2caClaude35import savedReplyRoutes from "./routes/saved-replies";
36import deploymentRoutes from "./routes/deployments";
6563f0aClaude37import orgRoutes from "./routes/orgs";
2df1f8cClaude38import passkeyRoutes from "./routes/passkeys";
058d752Claude39import oauthRoutes from "./routes/oauth";
40import developerAppsRoutes from "./routes/developer-apps";
eafe8c6Claude41import workflowRoutes from "./routes/workflows";
25a91a6Claude42import packagesApiRoutes from "./routes/packages-api";
43import packagesUiRoutes from "./routes/packages";
44import pagesRoutes from "./routes/pages";
45import environmentsRoutes from "./routes/environments";
79136bbClaude46import webRoutes from "./routes/web";
47
48const app = new Hono();
49
3ef4c9dClaude50// Request context (request ID, start time) runs before everything else
51app.use("*", requestContext);
05b973eClaude52// Middleware — compression first (wraps all responses)
53app.use("*", compress());
54// Logger only on non-git routes to avoid overhead on clone/push
55app.use("*", async (c, next) => {
56 if (c.req.path.includes(".git/")) return next();
57 return logger()(c, next);
58});
79136bbClaude59app.use("/api/*", cors());
3ef4c9dClaude60// Rate-limit API + auth endpoints (generous default)
61app.use("/api/*", rateLimit({ windowMs: 60_000, max: 120 }));
62app.use("/login", rateLimit({ windowMs: 60_000, max: 20 }));
63app.use("/register", rateLimit({ windowMs: 60_000, max: 10 }));
79136bbClaude64
65// Git Smart HTTP protocol routes (must be before web routes)
66app.route("/", gitRoutes);
67
3ef4c9dClaude68// Health + metrics
69app.route("/", healthRoutes);
70
ad6d4adClaude71// Inbound API hooks (GateTest callback + backup PAT-authed /api/v1/gate-runs)
72app.route("/", hookRoutes);
73
79136bbClaude74// REST API
75app.route("/", apiRoutes);
76
77// Auth routes (register, login, logout)
78app.route("/", authRoutes);
79
80// Settings routes (profile, SSH keys)
81app.route("/", settingsRoutes);
82
7298a17Claude83// 2FA / TOTP settings (Block B4)
84app.route("/", settings2faRoutes);
85
2df1f8cClaude86// WebAuthn / passkey routes (Block B5)
87app.route("/", passkeyRoutes);
88
058d752Claude89// OAuth 2.0 provider (Block B6)
90app.route("/", oauthRoutes);
91app.route("/", developerAppsRoutes);
92
6fc53bdClaude93// Theme toggle (dark/light cookie)
94app.route("/", themeRoutes);
95
96// Audit log UI
97app.route("/", auditRoutes);
98
99// Reactions API (issues, PRs, comments)
100app.route("/", reactionRoutes);
101
24cf2caClaude102// Saved replies (per-user canned comment templates)
103app.route("/", savedReplyRoutes);
104
105// Environments + deployment history UI
106app.route("/", deploymentRoutes);
107
6563f0aClaude108// Organizations + teams (Block B1)
109app.route("/", orgRoutes);
110
c81ab7aClaude111// API tokens
112app.route("/", tokenRoutes);
113
3ef4c9dClaude114// Notifications inbox
115app.route("/", notificationRoutes);
116
117// Dashboard (/dashboard)
118app.route("/", dashboardRoutes);
119
120// AI assistant — /ask + /:owner/:repo/ask
121app.route("/", askRoutes);
122
123// Global search
124app.route("/", searchRoutes);
125
79136bbClaude126// Repo settings (description, visibility, delete)
127app.route("/", repoSettings);
128
c81ab7aClaude129// Webhooks management
130app.route("/", webhookRoutes);
131
79136bbClaude132// Compare view (branch diffs)
133app.route("/", compareRoutes);
134
135// Issue tracker
136app.route("/", issueRoutes);
137
0074234Claude138// Pull requests
139app.route("/", pullRoutes);
140
c81ab7aClaude141// Fork
142app.route("/", forkRoutes);
143
0074234Claude144// Web file editor
145app.route("/", editorRoutes);
146
43de941Claude147// Contributors
148app.route("/", contributorRoutes);
149
3ef4c9dClaude150// Releases
151app.route("/", releaseRoutes);
152
153// Gates (history + settings + branch protection)
154app.route("/", gateRoutes);
155
eafe8c6Claude156// Actions-equivalent workflow runner (Block C1)
157app.route("/", workflowRoutes);
158
25a91a6Claude159// Package registry — npm protocol + UI (Block C2)
160app.route("/", packagesApiRoutes);
161app.route("/", packagesUiRoutes);
162
163// Pages / static hosting (Block C3)
164app.route("/", pagesRoutes);
165
166// Environments with protected approvals (Block C4)
167app.route("/", environmentsRoutes);
168
3ef4c9dClaude169// Insights + milestones
170app.route("/", insightsRoutes);
171
c81ab7aClaude172// Explore page
173app.route("/", exploreRoutes);
174
79136bbClaude175// Web UI (catch-all, must be last)
176app.route("/", webRoutes);
177
178// Global 404
179app.notFound((c) => {
180 return c.html(
181 <Layout title="Not Found">
182 <div class="empty-state">
183 <h2>404</h2>
184 <p>Page not found.</p>
185 <a href="/" style="margin-top: 12px; display: inline-block">
186 Go home
187 </a>
188 </div>
189 </Layout>,
190 404
191 );
192});
193
194// Global error handler
195app.onError((err, c) => {
196 console.error("[error]", err);
197 return c.html(
198 <Layout title="Error">
199 <div class="empty-state">
200 <h2>Something went wrong</h2>
201 <p>An unexpected error occurred.</p>
202 {process.env.NODE_ENV !== "production" && (
203 <pre style="margin-top: 16px; text-align: left; font-size: 12px; color: var(--red)">
204 {err.message}
205 </pre>
206 )}
207 </div>
208 </Layout>,
209 500
210 );
211});
212
213export default app;