Skip to content

Commit 7ea1785

Browse files
authored
Initial commit
0 parents  commit 7ea1785

Some content is hidden

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

63 files changed

+10014
-0
lines changed

.env.example

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Add your env variables here
2+
APP_DEPLOYMENT_ENV="staging"

.env.test

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Add your env variables here
2+
APP_DEPLOYMENT_ENV="staging"

.github/PULL_REQUEST_TEMPLATE.md

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
Fixes #
2+
3+
# Description
4+
5+
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context.
6+
List any dependencies that are required for this change.
7+
8+
## Type of change
9+
10+
Please mark relevant options with an `x` in the brackets.
11+
12+
- [ ] Bug fix (non-breaking change which fixes an issue)
13+
- [ ] New feature (non-breaking change which adds functionality)
14+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
15+
- [ ] This change requires a documentation update
16+
- [ ] Algorithm update - updates algorithm documentation/questions/answers etc.
17+
- [ ] Other (please describe):
18+
19+
# How Has This Been Tested?
20+
21+
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also
22+
list any relevant details for your test configuration
23+
24+
- [ ] Integration tests
25+
- [ ] Unit tests
26+
- [ ] Manual tests
27+
- [ ] No tests required
28+
29+
# Reviewer checklist
30+
31+
Mark everything that needs to be checked before merging the PR.
32+
33+
- [ ] Check if the UI is working as expected and is satisfactory
34+
- [ ] Check if the code is well documented
35+
- [ ] Check if the behavior is what is expected
36+
- [ ] Check if the code is well tested
37+
- [ ] Check if the code is readable and well formatted
38+
- [ ] Additional checks (document below if any)
39+
40+
# Screenshots (if appropriate):
41+
42+
# Questions (if appropriate):

.github/workflows/validate.yml

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: 🚀 Validation Pipeline
2+
concurrency:
3+
group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }}
4+
cancel-in-progress: true
5+
on:
6+
push:
7+
branches: [main]
8+
pull_request:
9+
branches: [main]
10+
permissions:
11+
actions: write
12+
contents: read
13+
# Required to put a comment into the pull-request
14+
pull-requests: write
15+
jobs:
16+
lint:
17+
name: ⬣ Biome lint
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
- uses: biomejs/setup-biome@v2
22+
- run: biome ci . --reporter=github
23+
24+
typecheck:
25+
needs: lint
26+
name: 🔎 Type check
27+
runs-on: ubuntu-latest
28+
steps:
29+
- uses: actions/checkout@v4
30+
- uses: pnpm/action-setup@v4
31+
- uses: actions/setup-node@v4
32+
with:
33+
node-version-file: "package.json"
34+
cache: "pnpm"
35+
- run: pnpm install --prefer-offline --frozen-lockfile
36+
- run: pnpm run typecheck
37+
38+
vitest:
39+
needs: typecheck
40+
name: ⚡ Unit Tests
41+
runs-on: ubuntu-latest
42+
steps:
43+
- uses: actions/checkout@v4
44+
- uses: pnpm/action-setup@v4
45+
- uses: actions/setup-node@v4
46+
with:
47+
node-version-file: "package.json"
48+
cache: "pnpm"
49+
- run: pnpm install --prefer-offline --frozen-lockfile
50+
- run: pnpm run test:cov
51+
- name: "Report Coverage"
52+
# Only works if you set `reportOnFailure: true` in your vite config as specified above
53+
if: always()
54+
uses: davelosert/vitest-coverage-report-action@v2

.gitignore

+94
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
node_modules
2+
public/build
3+
build
4+
dist
5+
out
6+
coverage
7+
.history
8+
.react-router
9+
10+
# Other Coverage tools
11+
*.lcov
12+
13+
# macOS
14+
.DS_*
15+
16+
# Cache Directories and files
17+
.cache
18+
.yarn*
19+
.env*
20+
!.env.example
21+
.swp*
22+
.turbo
23+
.npm
24+
.stylelintcache
25+
*.tsbuildinfo
26+
.node_repl_history
27+
28+
# Lock files from other package managers
29+
package-lock.json
30+
yarn.lock
31+
32+
# General tempory files and directories
33+
t?mp
34+
.t?mp
35+
*.t?mp
36+
37+
# Docusaurus cache and generated files
38+
.docusaurus
39+
40+
# Output of 'npm pack'
41+
*.tgz
42+
*.tar
43+
*.tar.gz
44+
*.tar.bz2
45+
*.tbz
46+
*.zip
47+
48+
# Runtime data
49+
pids
50+
*.pid
51+
*.seed
52+
*.pid.lock
53+
54+
# Diagnostic reports (https://nodejs.org/api/report.html)
55+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
56+
57+
# Logs
58+
logs
59+
*.log
60+
npm-debug.log*
61+
yarn-debug.log*
62+
yarn-error.log*
63+
lerna-debug.log*
64+
.pnpm-debug.log*
65+
vite.config.ts.*
66+
67+
# Playwright various test reports
68+
test-results
69+
playwright-report
70+
blob-report
71+
72+
73+
# Editors
74+
.idea/workspace.xml
75+
.idea/usage.statistics.xml
76+
.idea/shelf
77+
78+
79+
# Make it harder to accidentally commit files in the root
80+
/*.json
81+
/*.yaml
82+
/*.yml
83+
/*.toml
84+
/*.ts
85+
/*.tsx
86+
/*.js
87+
/*.jsx
88+
/*.sh
89+
90+
# Dont commit sqlite database files
91+
*.db
92+
*.sqlite
93+
*.sqlite3
94+
*.db-journal

.npmrc

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
enable-pre-post-scripts=true
2+
side-effects-cache=false
3+
save-exact=true
4+
audit=false
5+
fund=false
6+
progress=false

.vscode/extensions.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"recommendations": ["codeforge.remix-forge", "biomejs.biome"]
3+
}

.vscode/settings.json

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"editor.formatOnSave": true,
3+
"editor.formatOnType": false,
4+
"editor.renderWhitespace": "all",
5+
"editor.rulers": [120, 160],
6+
"editor.codeActionsOnSave": {
7+
"source.fixAll": "always",
8+
"source.organizeImports": "never",
9+
"source.organizeImports.biome": "always",
10+
"quickfix.biome": "always"
11+
},
12+
"eslint.enable": false,
13+
"prettier.enable": false,
14+
"editor.insertSpaces": false,
15+
"editor.detectIndentation": false,
16+
"editor.tabSize": 2,
17+
"editor.trimAutoWhitespace": true,
18+
"workbench.colorCustomizations": {
19+
"editorWhitespace.foreground": "#333"
20+
},
21+
"files.trimTrailingWhitespace": true,
22+
"files.trimTrailingWhitespaceInRegexAndStrings": true,
23+
"files.trimFinalNewlines": true,
24+
"[yaml]": {
25+
"editor.defaultFormatter": "redhat.vscode-yaml"
26+
},
27+
"biome.enabled": true,
28+
"editor.defaultFormatter": "biomejs.biome",
29+
"[javascript][typescript][typescriptreact][javascriptreact][json][jsonc][vue][astro][svelte][css][graphql]": {
30+
"editor.defaultFormatter": "biomejs.biome"
31+
},
32+
"typescript.tsdk": "node_modules/typescript/lib",
33+
"explorer.fileNesting.patterns": {
34+
"*.ts": "${basename}.*.${extname}",
35+
".env": ".env.*",
36+
"*.tsx": "${basename}.*.${extname},${basename}.*.ts",
37+
"package.json": "*.json, *.yml, *.config.js, *.config.ts, *.yaml",
38+
"readme*": "AUTHORS, Authors, BACKERS*, Backers*, CHANGELOG*, CITATION*, CODEOWNERS, CODE_OF_CONDUCT*, CONTRIBUTING*, CONTRIBUTORS, COPYING*, CREDITS, Changelog*, Citation*, Code_Of_Conduct*, Codeowners, Contributing*, Contributors, Copying*, Credits, GOVERNANCE.MD, Governance.md, HISTORY.MD, History.md, LICENSE*, License*, MAINTAINERS, Maintainers, README-*, README_*, RELEASE_NOTES*, ROADMAP.MD, Readme-*, Readme_*, Release_Notes*, Roadmap.md, SECURITY.MD, SPONSORS*, Security.md, Sponsors*, authors, backers*, changelog*, citation*, code_of_conduct*, codeowners, contributing*, contributors, copying*, credits, governance.md, history.md, license*, maintainers, readme-*, readme_*, release_notes*, roadmap.md, security.md, sponsors*",
39+
"Readme*": "AUTHORS, Authors, BACKERS*, Backers*, CHANGELOG*, CITATION*, CODEOWNERS, CODE_OF_CONDUCT*, CONTRIBUTING*, CONTRIBUTORS, COPYING*, CREDITS, Changelog*, Citation*, Code_Of_Conduct*, Codeowners, Contributing*, Contributors, Copying*, Credits, GOVERNANCE.MD, Governance.md, HISTORY.MD, History.md, LICENSE*, License*, MAINTAINERS, Maintainers, README-*, README_*, RELEASE_NOTES*, ROADMAP.MD, Readme-*, Readme_*, Release_Notes*, Roadmap.md, SECURITY.MD, SPONSORS*, Security.md, Sponsors*, authors, backers*, changelog*, citation*, code_of_conduct*, codeowners, contributing*, contributors, copying*, credits, governance.md, history.md, license*, maintainers, readme-*, readme_*, release_notes*, roadmap.md, security.md, sponsors*",
40+
"README*": "AUTHORS, Authors, BACKERS*, Backers*, CHANGELOG*, CITATION*, CODEOWNERS, CODE_OF_CONDUCT*, CONTRIBUTING*, CONTRIBUTORS, COPYING*, CREDITS, Changelog*, Citation*, Code_Of_Conduct*, Codeowners, Contributing*, Contributors, Copying*, Credits, GOVERNANCE.MD, Governance.md, HISTORY.MD, History.md, LICENSE*, License*, MAINTAINERS, Maintainers, README-*, README_*, RELEASE_NOTES*, ROADMAP.MD, Readme-*, Readme_*, Release_Notes*, Roadmap.md, SECURITY.MD, SPONSORS*, Security.md, Sponsors*, authors, backers*, changelog*, citation*, code_of_conduct*, codeowners, contributing*, contributors, copying*, credits, governance.md, history.md, license*, maintainers, readme-*, readme_*, release_notes*, roadmap.md, security.md, sponsors*",
41+
"Dockerfile": "*.dockerfile, .devcontainer.*, .dockerignore, captain-definition, compose.*, docker-compose.*, dockerfile*"
42+
}
43+
}

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Forge 42
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
2+
3+
<p align="middle">
4+
<img width="900px" height="500px" src="./public/base-stack.png" />
5+
</p>
6+
7+
# Welcome to Forge 42 base-stack
8+
9+
This is a base-stack for Forge 42 projects. This stack is a starting point for all Forge 42 stacks with more
10+
advanced features. This is an ESM Vite stack with Remix.run / React Router v7.
11+
12+
It includes a basic setup for a project with Remix.run and:
13+
- TypeScript
14+
- TailwindCSS
15+
- Vite
16+
- Vitest (unit tests)
17+
- Scripting
18+
- Biome (linter & formatter)
19+
- i18n support (client and server)
20+
- Icons spritesheet generator
21+
- lefthook hooks
22+
- CI checks for quality control
23+
- react-router-devtools
24+
- Hono server
25+
- .env var handling for server and client
26+
- SEO robots.txt, sitemap-index and sitemap built in.
27+
28+
## Internationalization
29+
30+
This stack uses i18next for internationalization. It supports both client and server side translations.
31+
Features included out of the box:
32+
- Support for multiple languages
33+
- Typesafe resources
34+
- client side translations are fetched only when needed
35+
- language switcher
36+
- language detector (uses the request to detect the language, falls back to your fallback language)
37+
38+
## Hono server
39+
40+
This stack uses Hono for the server. More information about Hono can be found [here](https://honojs.dev/).
41+
Another important thing to note is that we use a dependency called `react-router-hono-server` which is a wrapper for Hono that allows us to use Hono in our React Router application.
42+
43+
The server comes preconfigured with:
44+
- i18next middleware
45+
- caching middleware for assets
46+
- easily extendable global application context
47+
- .env injection into context
48+
49+
In order to add your own middleware, extend the context, or anything along those lines, all you have to do is edit the server
50+
inside the `entry.server.tsx` file.
51+
52+
## .env handling
53+
54+
This stack parses your `.env` file and injects it into the server context. For the client side, in the `root.tsx` file, we use the `useLoaderData` hook to get the `clientEnv` from the server and set it as a global variable on the `window` called `env`.
55+
If you need to access the env variables in both environments, you can create a polyEnv helper like this:
56+
```ts
57+
// app/utils/env.ts
58+
// This will return the process.env on the server and window.env on the client
59+
export const polyEnv = typeof process !== "undefined" ? process.env : window.env;
60+
```
61+
The server will fail at runtime if you don't set your `.env` file properly.
62+
63+
## Getting started
64+
65+
1. Fork the repository
66+
67+
2. Install the dependencies:
68+
```bash
69+
pnpm install
70+
```
71+
3. Read through the README.md files in the project to understand our decisions.
72+
73+
4. Run the cleanup script:
74+
```bash
75+
pnpm cleanup
76+
```
77+
78+
This will remove everything in the project related to the base-stack like README.md etc.
79+
This is the first thing you should run after initializing the project.
80+
After it is run it will remove itself from the package.json.
81+
82+
5. Start the development server:
83+
```bash
84+
pnpm run dev
85+
```
86+
6. Happy coding!

0 commit comments

Comments
 (0)