This project utilizes Gel Data as its Database layer. Follow these simple instructions to get your team setup with Gel!
- Easiest way to do this is to create one through "sign in with github" sign in here
** Make sure to Authorize geldata to have Organization access
-
On the top of the webpage, you will see that it initially instantiates a personal cloud, but you want to create one for the Organization
-
Click on that and then click "Add Organization"
- there should be ones easily linked from your companies github
pnpm gel --version
- If this fails, please install pnpm (node/npm is required for this) .
# Download and install nvm:
> curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
# in lieu of restarting the shell
> \. "$HOME/.nvm/nvm.sh"
# Download and install Node.js:
> nvm install 22
# Verify the Node.js version:
> node -v # Should print "v22.19.0".
# Download and install pnpm:
> corepack enable pnpm
# Verify pnpm version:
> pnpm -v
**Random notes: when in gel GUI, to get out \q + enter
pnpm install
** You will run into an issue if you do not have an NPM token in your enviornment variables because there are private packages used that you need granted access for. (Kunai-Design-System)
-
To add the NPM token to env variables, Add a new file
.env.local- create a new query in the relevant queries/[].edgeql file.
- in a terminal type
pnpm generate queries - then type
pnpm generate queries --file<-- this creates the query file inside the db schema. - submit PR [check]
- update
default.gel - in a terminal, run
pnpm gel migration createand answer the prompts - then,
pnpm gel migrate pnpm gel uito see the changes!
- you need to do this when you make changes to schema and types so that you don't get incorrect typescript errors in your code
- in a terminal type
pnpm generate queries - then type
pnpm generate queries --file<-- this creates the query file inside the db schema. -pnpm generate interfaces pnpm generate edgeql-js
This project is using Qwik with QwikCity. QwikCity is just an extra set of tools on top of Qwik to make it easier to build a full site, including directory-based routing, layouts, and more.
Inside your project, you'll see the following directory structure:
├── public/
│ └── ...
└── src/
├── components/
│ └── ...
└── routes/
| └── ...
├── db/
│ └── ...
-
src/routes: Provides the directory-based routing, which can include a hierarchy oflayout.tsxlayout files, and anindex.tsxfile as the page. Additionally,index.tsfiles are endpoints. Please see the routing docs for more info. -
src/components: Recommended directory for components. -
src/db: Recommended directory for database models, database connections, and database queries. -
public: Any static assets, like images, can be placed in the public directory. Please see the Vite public directory for more info.
Development mode uses Vite's development server. The dev command will server-side render (SSR) the output during development.
pnpm start # or `yarn start`Note: during dev mode, Vite may request a significant number of
.jsfiles. This does not represent a Qwik production build.
The preview command will create a production build of the client modules, a production build of src/entry.preview.tsx, and run a local server. The preview server is only for convenience to preview a production build locally and should not be used as a production server.
pnpm run preview # or `yarn preview`The production build will generate client and server modules by running both client and server build commands. The build command will use Typescript to run a type check on the source code.
pnpm run build # or `yarn build`Basic setup to get the app running locally:
** We use a private package for our styling @kunai-design-system(https://github.com/kunai-consulting/kunai-design-system), so, please reach out to @PatrickJS @PatrickJS-kunaico to be added to the kunai-consulting npm organization. **THE APP WILL NOT WORK IF YOU DO NOT HAVE ACCESS TO THE PRIVATE REGISTRY.** **
pnpm install
pnpm run build
pnpm run dev
Cloudflare's wrangler CLI can be used to preview a production build locally. To start a local server, run:
pnpm run serve
Then visit http://localhost:5173/
- deploy to cloudflare pages
pnpm run build
pnpm run deploy
Cloudflare Page's function-invocation-routes config can be used to include, or exclude, certain paths to be used by the worker functions. Having a _routes.json file gives developers more granular control over when your Function is invoked.
This is useful to determine if a page response should be Server-Side Rendered (SSR) or if the response should use a static-site generated (SSG) index.html file.
By default, the Cloudflare pages adaptor does not include a public/_routes.json config, but rather it is auto-generated from the build by the Cloudflare adaptor. An example of an auto-generate dist/_routes.json would be:
{
"include": [
"/*"
],
"exclude": [
"/_headers",
"/_redirects",
"/build/*",
"/favicon.ico",
"/manifest.json",
"/service-worker.js",
"/about"
],
"version": 1
}
In the above example, it's saying all pages should be SSR'd. However, the root static files such as /favicon.ico and any static assets in /build/* should be excluded from the Functions, and instead treated as a static file.
In most cases the generated dist/_routes.json file is ideal. However, if you need more granular control over each path, you can instead provide you're own public/_routes.json file. When the project provides its own public/_routes.json file, then the Cloudflare adaptor will not auto-generate the routes config and instead use the committed one within the public directory.
So you have the project running locally, lets make sure we have the right setup for your own use. setup with your own github oAath app, env variables, etc.
Go to https://github.com/settings/developers and create a new OAuth App.
*Make sure that the authorization callback URL is set to "homepage URL" + /auth/callback/github i.e.
homepage URL = http://localhost:1000/
then
authorization callback URL = http://localhost:1000/auth/callback/github
- If your org already has an oauth app setup, you can add your own private key to it, and put the client id and secret in the repo secrets. *
*MAKE SURE TO COPY THE CLIENT SECRET PROVIDED ONCE YOU CREATE THE OAUTH APP
AUTH_GITHUB_ID=your_client_id
AUTH_GITHUB_SECRET=your_client_secret
In order to install certain dependencies in this project you must be added to the Kunai NPM Organization. Reach out to @PatrickJS for an invite.
Next, create an access token in NPM: https://docs.npmjs.com/creating-and-viewing-access-tokens
Save this to your local environment as NPM_TOKEN
This specific process will vary depending on your OS.
For example, for Mac, you can edit your ~/.zshrc: export NPM_TOKEN=xxxx