|
1 |
| -# create-svelte |
| 1 | +# Console frontend |
2 | 2 |
|
3 |
| -Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte). |
| 3 | +## Development |
4 | 4 |
|
5 |
| -## Creating a project |
6 |
| - |
7 |
| -If you're seeing this, you've probably already done this step. Congrats! |
| 5 | +The following snippet contains the most important commands for development. |
8 | 6 |
|
9 | 7 | ```bash
|
10 |
| -# create a new project in the current directory |
11 |
| -npm create svelte@latest |
| 8 | +npm install |
| 9 | +cp .env.example .env # Copy the example environment file |
| 10 | +npm run dev # Starts a development server on port 5173 |
12 | 11 |
|
13 |
| -# create a new project in my-app |
14 |
| -npm create svelte@latest my-app |
| 12 | +npm run check # Check for various issues |
| 13 | +npm run lint # Lint the code |
| 14 | +npm run format # Format the code (Or use a Prettier extension in your editor) |
15 | 15 | ```
|
16 | 16 |
|
17 |
| -## Developing |
| 17 | +## User |
18 | 18 |
|
19 |
| -Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server: |
| 19 | +In production `api` uses oauth2 to authenticate users. |
| 20 | +In developmen |
20 | 21 |
|
21 |
| -```bash |
22 |
| -npm run dev |
| 22 | +### Local user override |
23 | 23 |
|
24 |
| -# or start the server and open the app in a new browser tab |
25 |
| -npm run dev -- --open |
26 |
| -``` |
| 24 | +When running locally, the frontend will proxy requests to the backend through a Vite Proxy. |
| 25 | +This proxy will add a special header for local development to specify which user to run as. |
27 | 26 |
|
28 |
| -## Building |
| 27 | +There's two well known users: |
29 | 28 |
|
30 |
| -To create a production version of your app: |
| 29 | +| User | Description | |
| 30 | +| --------------------------- | ---------------------------------------------------- | |
| 31 | +| `[email protected]` | A user with tenant wide permissions, but owns a team | |
| 32 | +| `[email protected]` | A user with all permissions | |
31 | 33 |
|
32 |
| -```bash |
33 |
| -npm run build |
34 |
| -``` |
| 34 | +You can specify which user to run as through `.env`. |
| 35 | +See `.env.example` for an example. |
35 | 36 |
|
36 |
| -You can preview the production build with `npm run preview`. |
| 37 | +### Using OAUTH |
37 | 38 |
|
38 |
| -> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment. |
| 39 | +To use the oauth flow, you need to configure `api` with correct credentials, and the user has to exist in the database. |
0 commit comments