File size: 2,836 Bytes
a7277a1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dd861a9
 
 
 
 
 
 
 
a7277a1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dd861a9
a7277a1
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# Coding Interview

Use the password supplied by your interviewer. Keep your work in the repository already open in the editor:

```text
/home/coder/workspace
```

## Python environment

Python 3.12 is ready, and this project uses **uv** for dependency and environment management:

- `pyproject.toml` lists the direct dependencies available for the exercise.
- `uv.lock` records the exact resolved dependency versions.
- `.venv` contains the active virtual environment.

Useful checks:

```bash
pwd
python --version
uv --version
uv tree
git status
```

Add a dependency with:

```bash
uv add <package>
```

After editing `pyproject.toml` manually, synchronize the environment with:

```bash
uv sync
```

## AI coding assistant

Claude Code is preconfigured for this interview and uses Claude Opus 4.8. No Anthropic account or separate sign-in is required.

Open Claude Code from the activity bar and use it when the interview instructions permit AI assistance. Do not change its provider or model configuration. Prompts and responses may be reviewed as part of the interview.

If Claude Code reports an authentication or model error, tell the interviewer rather than starting an account-login flow.

## Run and preview a FastAPI app

Assuming the FastAPI application is exposed as `app` in `main.py`, start it in a terminal:

```bash
uv run uvicorn main:app --host 127.0.0.1 --port 8000 --reload
```

The first choice is to view Swagger UI inside the editor:

1. Open the Command Palette with **Ctrl/Cmd+Shift+P**.
2. Run **Browser: Open Integrated Browser**. In some editor versions, the command may be named **Simple Browser: Show**.
3. Open:

   ```text
   http://127.0.0.1:8000/docs
   ```

ReDoc is available at:

```text
http://127.0.0.1:8000/redoc
```

If the integrated browser does not open the local address, open the current code-server URL in a normal browser tab and append:

```text
/proxy/8000/docs
```

## Optional: expose the API with ngrok

Use ngrok only when a service outside the editor must reach your API, such as a webhook provider or an external API client.

Keep Uvicorn running, open a second terminal, and run:

```bash
ngrok http 8000
```

ngrok prints a public HTTPS URL. Append `/docs` to that URL to open Swagger UI, for example:

```text
https://<generated-address>.ngrok.app/docs
```

If ngrok asks for authentication and an authtoken was supplied for the interview, configure it once and retry:

```bash
ngrok config add-authtoken <token>
ngrok http 8000
```

The generated URL is publicly reachable. Do not expose credentials, environment variables, or sensitive data, and stop the tunnel with **Ctrl+C** when it is no longer needed.

## Source control

The workspace is already a Git repository on the `main` branch. Make commits at useful milestones and do not commit credentials or access tokens.