Skip to content

Commit d6204eb

Browse files
authored
Initialize JSON Schema endpoint (#1)
* setup example * Refine PRD * Adds Caddyfile * remove hono app * init example registry * update favicon * format * init json schema api * update deps * refacroe forge models export pattern * refactor schema endpoint structure * Fix registry example * cleanup internal deps
1 parent fd7ca43 commit d6204eb

58 files changed

Lines changed: 1555 additions & 1015 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/deploy-api.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Deploy API to GitHub Pages
2+
3+
on:
4+
# Trigger the workflow every time you push to the `main` branch
5+
# Using a different branch name? Replace `main` with your branch’s name
6+
push:
7+
branches: [ main ]
8+
# Allows you to run this workflow manually from the Actions tab on GitHub.
9+
workflow_dispatch:
10+
11+
# Allow this job to clone the repo and create a page deployment
12+
permissions:
13+
contents: read
14+
pages: write
15+
id-token: write
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout your repository using git
22+
uses: actions/checkout@v4
23+
- name: Install, build, and upload your site
24+
uses: withastro/action@v3
25+
with:
26+
path: apps/api # The root location of your Astro project inside the repository. (optional)
27+
# node-version: 20 # The specific version of Node that should be used to build your site. Defaults to 20. (optional)
28+
# package-manager: pnpm@latest # The Node package manager that should be used to install dependencies and build your site. Automatically detected based on your lockfile. (optional)
29+
30+
deploy:
31+
needs: build
32+
runs-on: ubuntu-latest
33+
environment:
34+
name: github-pages
35+
url: ${{ steps.deployment.outputs.page_url }}
36+
steps:
37+
- name: Deploy to GitHub Pages
38+
id: deployment
39+
uses: actions/deploy-pages@v4

.vscode/extensions.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
// Astro - Syntax Highlighting
1010
"astro-build.astro-vscode",
1111

12-
1312
// MDX - JSX in markdown
1413
"unifiedjs.vscode-mdx"
1514
],

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
// Triggers biome formatting on save.
3-
"[json][typescript][javascript][tsx][html][css][postcss][sql]": {
3+
"[json][typescript][javascript][tsx][html][css][postcss][sql][astro]": {
44
"editor.codeActionsOnSave": {
55
"source.fixAll.ts": "explicit",
66
"source.organizeImports": "explicit"

CONTRIBUTING

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@ The source code for the official [Documentation Website](https://docs.dhfs.dev),
9292
`/apps/schema`
9393
Infrastructure for publishing and hosting the generated JSON Schema files, making them available at [schema.dhfs.dev](https://schema.dhfs.dev).
9494

95+
#### ⚡️ registry
96+
`/apps/registry`
97+
A working demonstration of a hosted repository. Available at [repo.dhfs.dev](https://repo.dhfs.dev).
98+
9599
### GitHub
96100
`/.github/`
97101
Contains GitHub-specific files, including workflow definitions for CI/CD.

Caddyfile

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
local_certs
3+
email contact@dhfs.dev
4+
}
5+
6+
7+
api.localhost {
8+
encode gzip
9+
10+
# Vide node modules
11+
handle /node_modules/* {
12+
reverse_proxy localhost:4321
13+
}
14+
15+
reverse_proxy localhost:4321
16+
}
17+
18+
19+
docs.localhost {
20+
encode gzip
21+
22+
# Vide node modules
23+
handle /node_modules/* {
24+
reverse_proxy localhost:4322
25+
}
26+
27+
reverse_proxy localhost:4322
28+
}
29+
30+
31+
registry.localhost {
32+
encode gzip
33+
34+
# Vide node modules
35+
handle /node_modules/* {
36+
reverse_proxy localhost:5173
37+
}
38+
39+
reverse_proxy localhost:5173
40+
}

README.PRD.md

Lines changed: 157 additions & 171 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ This repository uses a monorepo structure to manage different parts of the DHFS
5757
- `/packages/forge-models`: This is the heart\! It contains the **Zod schemas** which serve as the single source of truth for defining all DHFS data structures. Typescript types and JSON Schemas are generated from here.
5858
- `/apps/docs`: Houses the source code for our [Documentation Website](https://docs.dhfs.dev).
5959
- `/apps/schema`: Contains the necessary files and infrastructure to publish and host the generated **JSON Schema files**. This makes the machine-readable schemas available at stable, versioned URLs like [schema.dhfs.dev/v1](https://schema.dhfs.dev/v1).
60+
- `/apps/registry`: A working demonstration of a hosted repository. Available at [repo.dhfs.dev](https://repo.dhfs.dev).
6061
- _(Other internal packages may exist but are primarily for development support)._
6162

6263
## Further Reading & Governance

apps/api/.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# build output
2+
dist/
3+
4+
# generated types
5+
.astro/
6+
7+
# dependencies
8+
node_modules/
9+
10+
# logs
11+
npm-debug.log*
12+
yarn-debug.log*
13+
yarn-error.log*
14+
pnpm-debug.log*
15+
16+
# environment variables
17+
.env
18+
.env.production
19+
20+
# macOS-specific files
21+
.DS_Store
22+
23+
# jetbrains setting folder
24+
.idea/

apps/api/README.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Astro Starter Kit: Basics
2+
3+
```sh
4+
pnpm create astro@latest -- --template basics
5+
```
6+
7+
[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/withastro/astro/tree/latest/examples/basics)
8+
[![Open with CodeSandbox](https://assets.codesandbox.io/github/button-edit-lime.svg)](https://codesandbox.io/p/sandbox/github/withastro/astro/tree/latest/examples/basics)
9+
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/withastro/astro?devcontainer_path=.devcontainer/basics/devcontainer.json)
10+
11+
> 🧑‍🚀 **Seasoned astronaut?** Delete this file. Have fun!
12+
13+
![just-the-basics](https://github.com/withastro/astro/assets/2244813/a0a5533c-a856-4198-8470-2d67b1d7c554)
14+
15+
## 🚀 Project Structure
16+
17+
Inside of your Astro project, you'll see the following folders and files:
18+
19+
```text
20+
/
21+
├── public/
22+
│ └── favicon.svg
23+
├── src/
24+
│ ├── layouts/
25+
│ │ └── Layout.astro
26+
│ └── pages/
27+
│ └── index.astro
28+
└── package.json
29+
```
30+
31+
To learn more about the folder structure of an Astro project, refer to [our guide on project structure](https://docs.astro.build/en/basics/project-structure/).
32+
33+
## 🧞 Commands
34+
35+
All commands are run from the root of the project, from a terminal:
36+
37+
| Command | Action |
38+
| :------------------------ | :----------------------------------------------- |
39+
| `pnpm install` | Installs dependencies |
40+
| `pnpm dev` | Starts local dev server at `localhost:4321` |
41+
| `pnpm build` | Build your production site to `./dist/` |
42+
| `pnpm preview` | Preview your build locally, before deploying |
43+
| `pnpm astro ...` | Run CLI commands like `astro add`, `astro check` |
44+
| `pnpm astro -- --help` | Get help using the Astro CLI |
45+
46+
## 👀 Want to learn more?
47+
48+
Feel free to check [our documentation](https://docs.astro.build) or jump into our [Discord server](https://astro.build/chat).

apps/api/astro.config.mjs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// @ts-check
2+
import { defineConfig } from "astro/config";
3+
4+
import sitemap from "@astrojs/sitemap";
5+
6+
import tailwindcss from "@tailwindcss/vite";
7+
8+
// https://astro.build/config
9+
export default defineConfig({
10+
site: "https://api.dhfs.dev",
11+
integrations: [sitemap()],
12+
13+
server: {
14+
port: 4321,
15+
},
16+
17+
vite: {
18+
plugins: [tailwindcss()],
19+
},
20+
});

0 commit comments

Comments
 (0)