Skip to content

Commit 13114f7

Browse files
author
Almina Brulić
authored
Initial commit
0 parents  commit 13114f7

Some content is hidden

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

72 files changed

+9343
-0
lines changed

.env.example

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Add your env variables here
2+
3+
# The environment of the app. This is different from NODE_ENV, and will be used for deployments.
4+
# Default: development
5+
#APP_ENV="staging"

.env.test

Lines changed: 2 additions & 0 deletions
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

Lines changed: 42 additions & 0 deletions
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

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
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+
check-unused:
39+
needs: lint
40+
name: ✂️ Check unused code
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 check:unused
51+
52+
vitest:
53+
needs: typecheck
54+
name: ⚡ Unit Tests
55+
runs-on: ubuntu-latest
56+
steps:
57+
- uses: actions/checkout@v4
58+
- uses: pnpm/action-setup@v4
59+
- uses: actions/setup-node@v4
60+
with:
61+
node-version-file: "package.json"
62+
cache: "pnpm"
63+
- run: pnpm install --prefer-offline --frozen-lockfile
64+
- run: pnpm exec playwright install chromium --with-deps
65+
- run: pnpm run test:cov
66+
- name: "Report Coverage"
67+
# Only works if you set `reportOnFailure: true` in your vite config as specified above
68+
if: always()
69+
uses: davelosert/vitest-coverage-report-action@v2

.gitignore

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
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+
# Dont commit sqlite database files
79+
*.db
80+
*.sqlite
81+
*.sqlite3
82+
*.db-journal

.npmrc

Lines changed: 6 additions & 0 deletions
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

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

.vscode/settings.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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, *.workspace.ts",
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+
"[typescriptreact]": {
44+
"editor.defaultFormatter": "biomejs.biome"
45+
}
46+
}

LICENSE

Lines changed: 21 additions & 0 deletions
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

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

0 commit comments

Comments
 (0)