You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+10-85
Original file line number
Diff line number
Diff line change
@@ -4,110 +4,35 @@ Every application or package built to support IC Hack'25 tech.
4
4
5
5
## What is in this?
6
6
7
+
This is a gigantic single running Nuxt4 application. The 3 main frontend applications are separated under subdomain routing.
8
+
7
9
-[Server (Perry)](./server/) - First time custom backend server built.
8
-
-[Admin (Ferb)](./app) - An insider website that manages users, teams, announcements... admin stuff - tbd to be app/pages/admin or something. update before merge.
10
+
-[Admin (Ferb)](./app/pages/$admin/) - An admin dashboard website that manages users, teams, announcements.
11
+
-[Internal (Phineas)](./app/pages/$my/) - The Internal Website used by hackers, volunteers, etc.
12
+
-[Landing Page (Isabella)](./app/pages/$www/) - A static landing page.
9
13
10
14
## Before you start
11
15
12
16
1. You must read this README in full.
13
17
1. Read relevant portions of the documentation.
14
18
15
19
> [!note]
16
-
> All ichack related systems every year are **private**. Feel free to fork this repository but keep it private. You could make your repo public after IC Hack is over, but make sure there are no senstive information in the repository.
20
+
> All ichack related systems every year are **private**. A public **port** (not _fork_) of the repository is allowed but all sensitive information must be deleted from all commit history.
17
21
18
22
## Documentation
19
23
20
24
This is the first time IC Hack tech systems will have extensive documentation. Open [the docs folder](./documentation/) as an [Obsidian Vault](https://obsidian.md).
21
25
26
+
1. Install [Obsidian](https://obsidian.md/).
27
+
2. Open the path `./documentation` as an Obsidian Vault.
28
+
22
29
> [!important]
23
30
> The documentation started authoring from 4th July 2024. The contributors will try to document this code as much as possible and encourage the future volunteers to do so as well. However, it may not be the case that everything is documented perfectly.
24
31
>
25
32
> As a result, some or most of the pages here will be incomplete. Over time, we will do our best that it does not happen.
26
33
>
27
34
> The tense used in the documentation will be confusing depending on the date it was written and the event that was spoken about.
28
35
29
-
## How to run?
30
-
31
-
### Pre-setup
32
-
33
-
You'll need Docker, bun, and psql installed.
34
-
35
-
### Environment Variables
36
-
37
-
Without setting environment variables, your code will not execute or behave correctly. Copy the `.env.template` file into `.env.local` and `.env.test` and fill it appriorately.
38
-
39
-
#### Dev setup
40
-
41
-
```env
42
-
PGUSER=admin
43
-
PGPASSWORD=rootpasswd
44
-
PGDB=postgres
45
-
PGHOST=0.0.0.0
46
-
PGPORT=5432
47
-
48
-
DISCORD_CLIENT_ID=anything, you'll know if you're testing this
49
-
DISCORD_SERVER_ID=see above
50
-
DISCORD_CLIENT_SECRET=see above
51
-
```
52
-
53
-
#### Test setup
54
-
55
-
```env
56
-
PGUSER=test
57
-
PGPASSWORD=test
58
-
PGDB=postgres
59
-
PGHOST=0.0.0.0
60
-
PGPORT=5432
61
-
PGCA=
62
-
63
-
DISCORD_CLIENT_ID=
64
-
DISCORD_SERVER_ID=
65
-
DISCORD_CLIENT_SECRET=
66
-
```
67
-
68
-
### Docker Compose
69
-
70
-
> [!important]
71
-
> If you use windows, please try working on WSL2 since our codebase works best inside a Unix/Linux environment.
72
-
73
-
In the root directory of the project, execute:
74
-
75
-
```bash
76
-
bun install
77
-
bun reset-db
78
-
bun run dev
79
-
```
80
-
81
-
You can visit the admin page at `localhost:3000`. This will be updated to `admin.localhost:3000` soon:tm:.
82
-
83
-
The api routes can be accessed from `localhost:3000/api`, as expected.
84
-
85
-
To stop the containers from running, simply use CTRL+C.
86
-
87
-
To add yourself as a god user for testing, edit and execute `bun run scripts/seed.ts`.
88
-
89
-
If you ran the project headless, execute (in the same root directory)
90
-
91
-
```bash
92
-
docker compose down
93
-
```
94
-
95
-
Refer to [Docker](./documentation/Techologies/Docker.md) to learn about how we containerised it and used compose.
96
-
97
-
#### Common Docker error
98
-
99
-
If you get the error
100
-
101
-
```
102
-
Error response from daemon: network 91cc91888ed27849c518f6769cf18115ddb56b0ef833e745e764964a6a2586da not found
103
-
```
104
-
105
-
Run the following command and try again.
106
-
107
-
```bash
108
-
docker-compose -f dev.docker-compose.yaml down --remove-orphans
109
-
```
110
-
111
36
## Development rules
112
37
113
38
### Working on issues
@@ -134,7 +59,7 @@ You should create a PR **as soon as** you create a branch.
134
59
1. The actual commit messages within your PR **does not follow** any conventional naming pattern. However, your PR title must follow `type: description` format, similar to your branch name.
135
60
1. If any of the repo admins approve your PR and you need to need to update your branch, consider rebase to avoid making another commit for the admins to review again.
136
61
137
-
#### PR <--> ClickUp Integration
62
+
#### PR <> ClickUp Integration
138
63
139
64
1. When you create a comment, in the description include the following text: `Link CU-86bzr6uwe`, you will find your taskId in the ClickUp Card you are working.
140
65
1. You can use special commit messages to change the status of your card. E.g. a commit message can be, `updated the readme #86bzr6uwe[in review]`.
The application runs in the Server-side rendering (SSR) mode. This means the HTML document is rendered on the server, and sent to the browser. The JavaScript files soon follow along and the JavaScript code then renders it again on the client side, giving the page the interactivity.
7
+
8
+
In the server side, when the requrest comes to render a page, a middleware is executed, more specifically `./server/middleware/subdomain.ts`. In this middleware, we analyse the hostname and extract the subdomain from it. The subdomain is then attached to the `ssrContext`, which is sent to the browser as a payload. Now that the middleware is executed and we have have the subdomain used (undefined if no subdomain was used), Nitro now understands that it isn't an API route, it is a page route. The handler is given to Nuxt to render the initial HTML render of the page.
9
+
10
+
When Nuxt is given the control from Nitro, it is intercepted by `app/router.options.ts` that returns a modified list of routes. This uses the subdomain to filter and map the existing list of routes. Nuxt finds the component function to render the page in the modified list of routes to render the page. In more detail, the `router.options.ts` has the payload from the server in the `ssrContext`. This also protects from any cross-domain access.
0 commit comments