Skip to content

Commit c7c4fa3

Browse files
Update readme
1 parent adc7aef commit c7c4fa3

1 file changed

Lines changed: 77 additions & 38 deletions

File tree

README.md

Lines changed: 77 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,26 @@ of children eligible for [Summer EBT](https://www.fns.usda.gov/summer/sunbucks)
1212
- Changing mailing address on file
1313
- Requesting a replacement EBT card
1414

15+
## Technology Stack overview
16+
17+
**Backend**
18+
19+
- Language/framework: [C# with .NET 10](https://dotnet.microsoft.com/en-us/languages/csharp)
20+
- Key libraries: [ASP.NET Core](https://dotnet.microsoft.com/en-us/apps/aspnet), [Serilog](https://serilog.net/), [Managed Extensibility Framework (MEF)](https://learn.microsoft.com/en-us/dotnet/standard/mef/), [EntityFramework (EF) Core](https://learn.microsoft.com/en-us/ef/core/)
21+
- Package manager: [NuGet](https://www.nuget.org/)
22+
23+
**Frontend**
24+
25+
- Language/framework: [NextJS 16](https://nextjs.org/) with TypeScript
26+
- Key libraries: next, react, [i18next](https://www.i18next.com/), react-i18next, tanstack/react-query, zod
27+
- Package manager: [pnpm](https://pnpm.io/)
28+
- Design system: [USWDS](https://designsystem.digital.gov/), with design tokens specified for each state
29+
30+
**Infrastructure**
31+
32+
- Infrastructure as Code using OpenTofu (Terraform) - see [tofu](./tofu/)
33+
- Docker with [docker-compose](https://docs.docker.com/compose/) for local development
34+
1535
## Local Environment Set Up 🧰
1636

1737
> **Note:** The following steps assume you are working on macOS. Steps may differ if you are working on a different operating system.
@@ -25,64 +45,70 @@ of children eligible for [Summer EBT](https://www.fns.usda.gov/summer/sunbucks)
2545

2646
### 2. Clone repositories
2747

28-
Clone this repository on your local machine, alongside the [state connector repository](https://github.com/codeforamerica/sebt-self-service-portal-state-connector/) and any revelant state backend connector(s) - for example [DC](https://github.com/codeforamerica/sebt-self-service-portal-dc-connector) or [Colorado](https://github.com/codeforamerica/sebt-self-service-portal-co-connector) - as siblings (within the same parent folder)
48+
Clone this repository on your local machine, alongside the [state connector repository](https://github.com/codeforamerica/sebt-self-service-portal-state-connector/) and any revelant state backend connector(s) - for example, [Colorado](https://github.com/codeforamerica/sebt-self-service-portal-co-connector) - as siblings (within the same parent folder). Note that you will need to build and set up all repos as part of your local env setup.
2949

3050
```bash
3151
git clone git@github.com:codeforamerica/sebt-self-service-portal.git
52+
3253
git clone git@github.com:codeforamerica/sebt-self-service-portal-state-connector.git
3354

3455
# Colorado:
3556
git clone git@github.com:codeforamerica/sebt-self-service-portal-co-connector.git
36-
37-
# Washington, DC:
38-
git clone git@github.com:codeforamerica/sebt-self-service-portal-dc-connector.git
3957

4058
```
4159

42-
### 3. Create local environment variables
60+
### 3. Configure local environment
4361

44-
`.env` files are used in this project to set environment variables (eg, database configs). This is a preferred pattern for [12-factor Apps](https://www.12factor.net/config). You'll want to create '.env' files in your local environment, based on the example file.
62+
`.env` files are used in this project to set environment variables (eg, database configs). This is a preferred pattern for [12-factor Apps](https://www.12factor.net/config). They are also set to fallback to a generic default. You'll need to create `.env` files for your local environment, based on the example file.
4563

46-
From the root of this repository, run:
64+
To create your local .env file with configurations for the database and API, run this command in the root of the repo:
4765

4866
```bash
4967
cp .env.example .env
5068
```
5169

52-
You'll also want do the same from within /src/SEBT.Portal.Web:
70+
You'll want do the same from within `/src/SEBT.Portal.Web`:
5371

5472
```bash
5573
cp .env.example .env.local
5674
```
5775

58-
### 4. Install dependencies
76+
You'll also need an API `appsettings` file for your local machine with certain values set (see [state specific configuration](#state-specific-configuration) below):
77+
78+
```bash
79+
cd src/SEBT.Portal.Api
80+
cp appsettings.Development.example.json appsettings.Development.json
81+
```
82+
83+
### 4. Install dependencies
84+
85+
Front end
86+
87+
- To install all javascript package dependencies, run `pnpm install` from the root of this repository.
88+
- You can learn more about the front end in the [SEBT.Portal.Web README](./src/SEBT.Portal.Web/README.md)
89+
90+
Back end
5991

60-
- To install all javascript package dependencies, run `pnpm install` from the root of this repository
61-
- dotnet tool install --global dotnet-ef
6292
- .NET tools are CLI utilities installed and managed using [NuGet](https://www.nuget.org/). Currently, we are using the
63-
[`nuget-license`](https://www.nuget.org/packages/nuget-license) tool for auditing backend dependency license. Needed tools are defined in the tools
64-
manifest in `.config/dotnet-tools.json`. To install .NET tools, run `dotnet tool restore` from each solution root (ie, each top-level directory containing a `.sln` or `.slnx` file):
93+
[`nuget-license`](https://www.nuget.org/packages/nuget-license) tool for auditing backend dependency license. Needed tools are defined in the tools manifest in `.config/dotnet-tools.json`. To install .NET tools, run `dotnet tool restore` from each solution root (ie, each top-level directory containing a `.sln` or `.slnx` file):
6594
- /src/SEBT.Portal.Infrastructure
6695
- /src/SEBT.Portal.Api
6796

68-
- The first time you start up the application, you'll also want to run `dotnet build` from within the root of each repository
97+
- You'll also want to run `dotnet build` from within the root of each repository before starting up the app for the first time.
6998

7099
### 5. Start Services 💻
71100

72-
Make sure the docker daemon is running and you are logged in via your dockerhub account.
101+
Make sure Docker is installed and the docker daemon is running. When the database spins up locally, all migrations will be run and db seeded automatically (see [database setup](#database-setup) section below).
73102

74103
```bash
75-
docker compose up -d # Start MSSQL Database and Mailpit
104+
docker compose up -d # Start all docker containers, including MSSQL Database and Mailpit for testing
76105
```
77106

78-
79107
```bash
80-
pnpm dev # Start both API and frontend
108+
pnpm dev # Script to start both API (ie, `dotnet watch`) and frontend (ie, `next dev`)
81109
```
82110

83-
84-
To open the app, navigate to https://localhost:3000
85-
111+
To open the app, navigate to <https://localhost:3000>
86112

87113
## Development
88114

@@ -104,7 +130,7 @@ docker compose down -v
104130

105131
### Mailpit (Local Email Testing)
106132

107-
Mailpit captures all outgoing emails in development. Access the web UI at http://localhost:8025
133+
[Mailpit](https://mailpit.axllent.org/) captures all outgoing emails in local development. Once the Mailpit docker container is running on your machine, you can access its UI in your browser at <http://localhost:8025>
108134

109135
### Local Build & Test (Debug mode)
110136

@@ -182,11 +208,27 @@ Only include sections you want to override; other settings fall back to `appsett
182208

183209
### OIDC support
184210

185-
States can use an external OpenID Connect (OIDC) provider for sign-in. Code exchange and id_token validation run in the Next.js server; the .NET API performs "complete-login" (validates a short-lived callback token and returns a portal JWT that includes IdP claims such as phone and name).
211+
States can use an external [OpenID Connect (OIDC)](https://openid.net/developers/how-connect-works/) provider for sign-in. Code exchange and id_token validation run in the Next.js server; the .NET API performs "complete-login" (validates a short-lived callback token and returns a portal JWT that includes IdP claims such as phone and name).
212+
213+
For a deployment that uses OIDC, in `.env.local` under `SEBT.Portal.Web`, set:
186214

187-
For a deployment that uses OIDC, set in **Next.js** `.env.local`: `OIDC_DISCOVERY_ENDPOINT`, `OIDC_CLIENT_ID`, `OIDC_CLIENT_SECRET`, `OIDC_REDIRECT_URI`, `OIDC_COMPLETE_LOGIN_SIGNING_KEY` (at least 32 characters). Set the **same** value for `OIDC_COMPLETE_LOGIN_SIGNING_KEY` in the API as `Oidc:CompleteLoginSigningKey`. In the API, set `Oidc:DiscoveryEndpoint`, `Oidc:ClientId`, `Oidc:CallbackRedirectUri`, and optionally `Oidc:LanguageParam`. The API serves public config via `GET /api/auth/oidc/{stateCode}/config`.
215+
- `OIDC_DISCOVERY_ENDPOINT`
216+
- `OIDC_CLIENT_ID`
217+
- `OIDC_CLIENT_SECRET`
218+
- `OIDC_REDIRECT_URI`
219+
- `OIDC_COMPLETE_LOGIN_SIGNING_KEY` (at least 32 characters)
188220

189-
See `src/SEBT.Portal.Api/appsettings.Development.example.json` and [ADR-0008](docs/adr/0008-oidc-mycolorado-authentication-and-state-auth-context.md) for the design.
221+
In `appsettings` under `SEBT.Portal.Api`, set:
222+
223+
- `Oidc:CompleteLoginSigningKey` (same value as `OIDC_COMPLETE_LOGIN_SIGNING_KEY`)
224+
- `Oidc:DiscoveryEndpoint`
225+
- `Oidc:ClientId`
226+
- `Oidc:CallbackRedirectUri`
227+
- `Oidc:LanguageParam` (optional)
228+
229+
The API serves public config via `GET /api/auth/oidc/{stateCode}/config`.
230+
231+
See `appsettings.Development.example.json` and [ADR-0008](docs/adr/0008-oidc-mycolorado-authentication-and-state-auth-context.md).
190232

191233
### ID Proofing Requirements
192234

@@ -212,14 +254,9 @@ The application uses Microsoft SQL Server as its database. This is propped up v
212254

213255
#### Configuration
214256

215-
Database configuration is managed through environment variables. Copy `.env.example` to `.env` and customize as needed (this is a preferred pattern for [12-factor Apps](https://www.12factor.net/config)). They are also set to fallback to a generic default.
216-
217-
```bash
218-
cp .env.example .env
219-
```
220-
221-
Available environment variables:
257+
Configuration is managed through environment variables.
222258

259+
Available environment variables for `.env` in the respository root:
223260
**Database (for Docker Compose):**
224261

225262
- `MSSQL_SA_PASSWORD` - SQL Server SA password
@@ -233,20 +270,17 @@ Available environment variables:
233270
- `JWTSETTINGS__SECRETKEY` - Secret key for JWT token signing. Must be at least 32 characters.
234271
- `IDENTIFIERHASHER__SECRETKEY` - Secret key for HMAC-SHA256 hashing of Household Identifiers as needed. Must be at least 32 characters.
235272

236-
**OIDC (state IdP sign-in)**
237-
Set `OIDC_DISCOVERY_ENDPOINT`, `OIDC_CLIENT_ID`, `OIDC_CLIENT_SECRET`, `OIDC_REDIRECT_URI`, and `OIDC_COMPLETE_LOGIN_SIGNING_KEY` in Next.js `.env.local`. In the API, set `Oidc:CompleteLoginSigningKey` (same value), `Oidc:DiscoveryEndpoint`, `Oidc:ClientId`, and `Oidc:CallbackRedirectUri`. See `appsettings.Development.example.json` and [ADR-0008](docs/adr/0008-oidc-mycolorado-authentication-and-state-auth-context.md).
238-
239273
### Database Migrations
240274

241-
The application uses [Entity Framework Core migrations](https://learn.microsoft.com/en-us/ef/core/managing-schemas/migrations/?tabs=dotnet-core-cli) to manage database schema changes.
275+
The application uses [EF, or Entity Framework Core migrations](https://learn.microsoft.com/en-us/ef/core/managing-schemas/migrations/?tabs=dotnet-core-cli) to manage database schema changes.
242276

243277
#### Automatic Migrations
244278

245279
**Migrations run automatically on application startup.** When the API starts, it checks for pending migrations and applies them automatically. This ensures the database schema is always up-to-date.
246280

247281
#### Manual Migration Commands
248282

249-
While migrations run automatically, you can also manage them manually:
283+
While migrations run automatically, you can also manage them manually by installing `ef` on your local machine:
250284

251285
**List all migrations:**
252286

@@ -298,7 +332,7 @@ The database is automatically seeded with test users when running in the **Devel
298332
- Application startup (when migrations are applied)
299333
- `DbContext.EnsureCreated()` calls
300334

301-
The automatic seeding uses EF Core's `UseSeeding` mechanism under the hood. See https://learn.microsoft.com/en-us/ef/core/modeling/data-seeding
335+
The automatic seeding uses EF Core's `UseSeeding` mechanism under the hood. See <https://learn.microsoft.com/en-us/ef/core/modeling/data-seeding>
302336

303337
To help test different workflows and users in different states, the seeder will create the following users unless instructed otherwise:
304338

@@ -334,6 +368,11 @@ Alternatively, I'd highly recommend a tool like [LINQPad](https://www.linqpad.ne
334368

335369
More documentation can be found in the [docs](./docs) folder.
336370

371+
See also:
372+
373+
- [README for SEBT.Portal.Web (front end)](./src/SEBT.Portal.Web/README.md)
374+
- [README for Figma design token scripts](./src/SEBT.Portal.Web/design/scripts/README.md)
375+
337376
We use [Lightweight Architecture Decision Records](https://cognitect.com/blog/2011/11/15/documenting-architecture-decisions)
338377
for tracking architectural decisions, using [adr tools](https://github.com/npryce/adr-tools) to
339378
store them in source control. These can be found in the [docs/adr](./docs/adr) folder.

0 commit comments

Comments
 (0)