|
1 | 1 | # @voidcloud/dashboard |
2 | 2 |
|
3 | | -User-facing dashboard for Void. Built as a React Pages mode app, dogfooding the |
4 | | -platform. |
| 3 | +Authentication frontend for the Void platform. Built as a React Pages mode app, |
| 4 | +dogfooding the platform. |
5 | 5 |
|
6 | 6 | ## Architecture |
7 | 7 |
|
8 | 8 | - **React Pages mode** - `voidPlugin()` + `voidReact()`, SSR with client hydration. |
9 | | -- **API-only data access** - loaders and actions call the platform API. The dashboard |
10 | | - does not connect to platform Postgres directly. |
11 | 9 | - **Auth** - OAuth (GitHub/Google) via the platform's `/auth/login` flow. The JWT is |
12 | 10 | stored in an httpOnly cookie (`void_token`). Middleware validates the token with |
13 | 11 | `GET /me`. |
14 | | -- **Preview gate** - authenticated non-admin users see a gated page while the |
15 | | - dashboard is rebuilt. Admin users can access the dashboard routes. |
16 | 12 | - **Styling** - Tailwind CSS v4 with the Void design system from `@voidcloud/ui` |
17 | 13 | (VoidZero theme styles, fonts, assets, and React UI primitives). |
18 | 14 |
|
19 | 15 | ## Pages |
20 | 16 |
|
21 | | -| Route | Purpose | |
22 | | -| --------------- | ----------------------------------------------- | |
23 | | -| `/login` | OAuth buttons (GitHub, Google) | |
24 | | -| `/` | Admin-gated project list | |
25 | | -| `/projects/:id` | Deployments, usage, domains, secrets, resources | |
26 | | -| `/settings` | Profile | |
27 | | -| `/logout` | Clears cookie, redirects to login | |
| 17 | +| Route | Purpose | |
| 18 | +| ---------------- | ---------------------------------------- | |
| 19 | +| `/login` | OAuth buttons (GitHub, Google) | |
| 20 | +| `/auth/callback` | Exchanges the login response for a token | |
| 21 | +| `/` | Minimal authenticated confirmation page | |
| 22 | +| `/logout` | Clears cookie, redirects to login | |
28 | 23 |
|
29 | 24 | ## Local Development |
30 | 25 |
|
@@ -71,23 +66,18 @@ on the dashboard side, so it never activates in production. |
71 | 66 |
|
72 | 67 | ```text |
73 | 68 | lib/ |
74 | | - api.ts # Typed platform API client + fetch helpers |
| 69 | + api.ts # Typed authentication API fetch helpers |
75 | 70 | middleware/ |
76 | | - 01.auth.ts # void_token validation through /me + admin preview gate |
| 71 | + 01.auth.ts # void_token validation through /me |
77 | 72 | pages/ |
78 | | - layout.tsx # Top bar with nav + user info |
| 73 | + layout.tsx # Authenticated shell with logout |
79 | 74 | login.tsx # OAuth login buttons |
80 | 75 | login.server.ts # Builds provider login URLs |
81 | 76 | logout.tsx |
82 | 77 | logout.server.ts # Cookie clear + redirect |
83 | | - index.tsx # Project list or preview gate |
84 | | - index.server.ts # API reads for projects |
85 | | - settings.tsx # Profile |
86 | | - settings.server.ts # Session user from middleware |
| 78 | + index.tsx # Authenticated confirmation page |
| 79 | + index.server.ts # Session user from middleware |
87 | 80 | auth/ |
88 | 81 | callback.tsx |
89 | 82 | callback.server.ts # OAuth callback token/code exchange |
90 | | - projects/ |
91 | | - [id].tsx # Project detail |
92 | | - [id].server.ts # API reads/actions for project dashboard data |
93 | 83 | ``` |
0 commit comments