@@ -27,7 +27,7 @@ Two reference documents describe what the example must do and how it must
2727look. Both are references only — do not create these files in the actual
2828generated example app.
2929
30- ### < ARCHITECTURE.md>
30+ ### [ ARCHITECTURE.md] ( ./ARCHITECTURE.md )
3131
3232Defines the example's functional behavior. Consult it for:
3333
@@ -44,10 +44,11 @@ Defines the example's functional behavior. Consult it for:
4444 bridge between the framework routing layer and the federation layer.
4545 - ** Federation** and ** Storing** : Which source files to set up
4646 (` src/federation.ts ` , ` src/store.ts ` ) and the template files they are
47- based on (<example/src/federation.ts>, <example/src/store.ts>).
47+ based on ([ example/src/federation.ts] ( ./example/src/federation.ts ) ,
48+ [ example/src/store.ts] ( ./example/src/store.ts ) ).
4849 - ** Logging** : How to use ` @logtape/logtape ` and ` src/logging.ts ` .
4950
50- ### < DESIGN.md>
51+ ### [ DESIGN.md] ( ./DESIGN.md )
5152
5253Defines the example's visual presentation. Consult it for:
5354
@@ -61,7 +62,8 @@ Defines the example's visual presentation. Consult it for:
6162 - ** Layout principles** : Spacing, containers, grid, and whitespace.
6263 - ** Responsive behavior** : Single breakpoint at ` 768px ` and mobile
6364 adaptations.
64- - ** Static assets** : Files to serve from ` public/ ` (<example/public/\* >).
65+ - ** Static assets** : Files to serve from ` public/ `
66+ ([ example/public/] ( ./example/public/ ) ).
6567 - ** Page structure** : Detailed layout of the home page, actor profile
6668 page, and post detail page.
6769
@@ -70,46 +72,77 @@ Set up the example project
7072--------------------------
7173
7274Create an ` examples/framework/ ` app and write an example for the new
73- package. Unless the framework itself prevents it, support both Deno and
74- Node.js environments. If Deno is supported, add a * deno.json* based on
75- <example/deno.json>; if Node.js is supported, add * package.json* based on
76- <example/package.jsonc> and * tsdown.config.ts* . Depending on the supported
77- environments, add the example path to the ` workspace ` field in
78- the root * deno.json* and to the ` packages ` field in
79- * pnpm-workspace.yaml* .
75+ package. Copy the template files from [ example/] ( ./example/ ) as-is and modify
76+ as needed.
77+
78+ - [ deno.json] ( ./example/deno.jsonc )
79+ - Deno configuration for the example app.
80+ - If the framework does not support Deno, this file can be omitted.
81+ - [ package.json] ( ./example/package.jsonc )
82+ - Node.js configuration for the example app.
83+ - If the framework does not support Node.js, this file can be omitted.
84+ - [ federation.ts] ( ./example/src/federation.ts ) : Set up the Federation instance
85+ and configure ActivityPub handling.
86+ - [ logging.ts] ( ./example/src/logging.ts ) : Set up Logtape logging.
87+ - [ store.ts] ( ./example/src/store.ts ) : Set up in-memory stores for actors,
88+ posts, and followers.
89+ - [ fedify-logo.svg] ( ./example/public/fedify-logo.svg )
90+ - The Fedify logo.
91+ - Use this file as favicon.
92+ - You can make a custom logo to add the svg of the framework logo.
93+ - [ demo-profile.png] ( ./example/public/demo-profile.png ) :
94+ - Profile image for the demo user.
95+ - You can make this image from the ` fedify-logo.svg ` rendering to png
96+ - [ style.css] ( ./example/public/style.css ) : The CSS file for the example app.
97+ - [ theme.js] ( ./example/public/theme.js ) : The JavaScript file for theme
98+ toggling dark/light mode in the example app.
99+
100+ Unless the framework itself prevents it, support both Deno
101+ and Node.js environments. If Deno is supported, add a * deno.json* based on
102+ [ example/deno.json] ( ./example/deno.jsonc ) ; if Node.js is supported, add
103+ * package.json* based on [ example/package.jsonc] ( ./example/package.jsonc ) and
104+ * tsdown.config.ts* . Depending on the supported environments, add the example
105+ path to the ` workspace ` field in the root * deno.json* and to the ` packages `
106+ field in * pnpm-workspace.yaml* .
80107
81108If the framework is backend-only and needs a frontend framework, and there
82109is no natural pairing like solidstart-solid, use Hono.
83110
84- Copy the template files from <example/\* > as-is and modify as needed.
85-
86111If the framework does not have a prescribed entry point, use ` src/main.ts `
87112as the application entry point. Define and export the framework app in
88113` src/app.ts ` , then import and run it from the entry file. Import
89114` src/logging.ts ` in the entry file to initialize ` @logtape/logtape ` .
90115When logging is needed, use the ` getLogger ` function from ` @logtape/logtape `
91116to create a logger.
92117
118+ When configuring the example app server, disable host restrictions and allow
119+ all hosts so tunneled/public domains can access the app during development
120+ and tests.
121+
93122
94123Implement the example app
95124-------------------------
96125
97- Follow the specifications in < ARCHITECTURE.md> and <DESIGN.md> to
98- implement the example. In particular:
126+ Follow the specifications in [ ARCHITECTURE.md] ( ./ARCHITECTURE.md ) and
127+ [ DESIGN.md ] ( ./DESIGN.md ) to implement the example. In particular:
99128
100129 - Register the Fedify middleware in ` src/app.ts ` per the “Middleware
101130 integration” and “Reverse proxy support” sections of
102- < ARCHITECTURE.md> .
131+ [ ARCHITECTURE.md] ( ./ARCHITECTURE.md ) .
103132 - Set up federation logic in ` src/federation.ts ` based on
104- <example/src/federation.ts>. Set up in-memory stores in ` src/store.ts `
105- based on <example/src/store.ts>.
133+ [ example/src/federation.ts] ( ./example/src/federation.ts ) . Set up in-memory
134+ stores in ` src/store.ts ` based on
135+ [ example/src/store.ts] ( ./example/src/store.ts ) .
106136 - Implement all routes listed in the “Routing” section of
107- <ARCHITECTURE.md>, using ` RequestContext ` as described in the
108- “Server-side data access” section.
109- - Render HTML pages according to <DESIGN.md>. Serve static assets from
110- the ` public/ ` directory (copy from <example/public/\* >).
137+ [ ARCHITECTURE.md] ( ./ARCHITECTURE.md ) , using ` RequestContext ` as described
138+ in the “Server-side data access” section.
139+ - Render HTML pages according to [ DESIGN.md] ( ./DESIGN.md ) . Serve static assets
140+ from the ` public/ ` directory (copy from
141+ [ example/public/] ( ./example/public/ ) ).
111142 - Implement the SSE endpoint per the “Server-sent events” section of
112- <ARCHITECTURE.md>.
143+ [ ARCHITECTURE.md] ( ./ARCHITECTURE.md ) .
144+ - Ensure the app can build and run in the supported environments
145+ (Deno, Node.js, or both).
113146
114147
115148Test the example with ` mise test:examples `
@@ -142,6 +175,11 @@ is broken:
142175mise test:examples
143176~~~~
144177
178+ If the ` test:examples ` can not be run, just run the server and test with curl:
179+
180+ ~~~~ bash
181+ curl -H " Accept: application/activity+json" http://localhost:0000/users/demo
182+
145183
146184Lint, format, and final checks
147185------------------------------
@@ -152,3 +190,4 @@ root path.
152190After implementation, run ` mise run fmt && mise check` .
153191If there are lint or format errors, fix them and run the command again until
154192there are no errors.
193+ ~ ~~~
0 commit comments