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.tsxBlame107 lines · 1 contributor
79136bbClaude1import { Hono } from "hono";
2import { logger } from "hono/logger";
3import { cors } from "hono/cors";
4import { Layout } from "./views/layout";
5import gitRoutes from "./routes/git";
6import apiRoutes from "./routes/api";
7import authRoutes from "./routes/auth";
8import settingsRoutes from "./routes/settings";
9import issueRoutes from "./routes/issues";
10import repoSettings from "./routes/repo-settings";
11import compareRoutes from "./routes/compare";
0074234Claude12import pullRoutes from "./routes/pulls";
13import editorRoutes from "./routes/editor";
c81ab7aClaude14import forkRoutes from "./routes/fork";
15import webhookRoutes from "./routes/webhooks";
16import exploreRoutes from "./routes/explore";
17import tokenRoutes from "./routes/tokens";
43de941Claude18import contributorRoutes from "./routes/contributors";
79136bbClaude19import webRoutes from "./routes/web";
20
21const app = new Hono();
22
23// Middleware
24app.use("*", logger());
25app.use("/api/*", cors());
26
27// Git Smart HTTP protocol routes (must be before web routes)
28app.route("/", gitRoutes);
29
30// REST API
31app.route("/", apiRoutes);
32
33// Auth routes (register, login, logout)
34app.route("/", authRoutes);
35
36// Settings routes (profile, SSH keys)
37app.route("/", settingsRoutes);
38
c81ab7aClaude39// API tokens
40app.route("/", tokenRoutes);
41
79136bbClaude42// Repo settings (description, visibility, delete)
43app.route("/", repoSettings);
44
c81ab7aClaude45// Webhooks management
46app.route("/", webhookRoutes);
47
79136bbClaude48// Compare view (branch diffs)
49app.route("/", compareRoutes);
50
51// Issue tracker
52app.route("/", issueRoutes);
53
0074234Claude54// Pull requests
55app.route("/", pullRoutes);
56
c81ab7aClaude57// Fork
58app.route("/", forkRoutes);
59
0074234Claude60// Web file editor
61app.route("/", editorRoutes);
62
43de941Claude63// Contributors
64app.route("/", contributorRoutes);
65
c81ab7aClaude66// Explore page
67app.route("/", exploreRoutes);
68
79136bbClaude69// Web UI (catch-all, must be last)
70app.route("/", webRoutes);
71
72// Global 404
73app.notFound((c) => {
74 return c.html(
75 <Layout title="Not Found">
76 <div class="empty-state">
77 <h2>404</h2>
78 <p>Page not found.</p>
79 <a href="/" style="margin-top: 12px; display: inline-block">
80 Go home
81 </a>
82 </div>
83 </Layout>,
84 404
85 );
86});
87
88// Global error handler
89app.onError((err, c) => {
90 console.error("[error]", err);
91 return c.html(
92 <Layout title="Error">
93 <div class="empty-state">
94 <h2>Something went wrong</h2>
95 <p>An unexpected error occurred.</p>
96 {process.env.NODE_ENV !== "production" && (
97 <pre style="margin-top: 16px; text-align: left; font-size: 12px; color: var(--red)">
98 {err.message}
99 </pre>
100 )}
101 </div>
102 </Layout>,
103 500
104 );
105});
106
107export default app;