Repository navigation
feat(auth): add login API endpoint for user authentication #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
e9d4fca
feat(auth): add login API endpoint for user authentication
abdelkabirouadoukou 8cb77bf
chore: update TypeScript version and refactor index page for consistency
abdelkabirouadoukou 48719db
feat(landing): add Boarding Pass and Route Trail components; update d…
abdelkabirouadoukou a4ac277
chore: update dependency configurations and enhance production readiness
abdelkabirouadoukou b230767
Refactor code structure for improved readability and maintainability
abdelkabirouadoukou ee2ff4f
chore: update package dependencies and improve code structure
abdelkabirouadoukou File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| # Copy to `.env` and fill in real values. Never commit `.env`. | ||
| # | ||
| # Convention: only variables prefixed `THEXJS_PUBLIC_` are safe to reference | ||
| # from client-shipped code. Everything else is server-only — reading it in a | ||
| # component, island, or action import fails the build. | ||
|
|
||
| # ---- Server ---- | ||
| # Port the server listens on (default: 3000) | ||
| PORT=3000 | ||
|
|
||
| # Set by the deploy platform; makes cookies `Secure` and picks production | ||
| # React builds. Don't set this to "development" in production. | ||
| NODE_ENV=production | ||
|
|
||
| # ---- Data layer (server-only) ---- | ||
| # Used by connectPostgres / connectSQLite defaults. | ||
| DATABASE_URL=postgres://user:password@localhost:5432/mydb | ||
|
|
||
| # ---- Rate limiting (optional, multi-instance only) ---- | ||
| # Used by createRedisRateLimitStore for cluster-wide rate limiting. | ||
| # REDIS_URL=redis://localhost:6379 | ||
|
|
||
| # ---- Public (safe for client code) ---- | ||
| # Example only: any THEXJS_PUBLIC_* variable may be read in the browser. | ||
| THEXJS_PUBLIC_API_URL=https://api.example.com | ||
|
|
||
| # ---- Secrets (server-only; never reference these in client code) ---- | ||
| # STRIPE_SECRET_KEY=sk_live_... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| # Dependabot — automated dependency updates. | ||
|
|
||
| version: 2 | ||
| updates: | ||
| # "bun" is the native ecosystem for bun.lock; "npm" can't parse bun.lock | ||
| # correctly and its versioning-strategy isn't supported for Bun. | ||
| - package-ecosystem: "bun" | ||
| directory: "/" | ||
| schedule: | ||
| interval: "weekly" | ||
| open-pull-requests-limit: 10 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| # Changelog | ||
|
|
||
| All notable changes to x are documented here. Format follows | ||
| [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project | ||
| uses [Calendar Versioning](https://calver.org/) with `YYYY.MM.DD` release | ||
| dates. This is a pre-1.0 project — expect breaking changes between releases. | ||
|
|
||
| ## Unreleased | ||
|
|
||
| ### Security | ||
|
|
||
| - Hardened `assertNoEnvLeakage`: it now also flags `import.meta.env["KEY"]`, | ||
| dynamic keys (`process.env[key]`), string-concatenated keys | ||
| (`process.env["ST"+"RIPE"]`), and aliased `process.env` access. | ||
| - Added a Redis-backed rate-limit store (`createRedisRateLimitStore`) for | ||
| multi-instance deployments, and rate-limiter buckets are now swept | ||
| automatically instead of only on explicit `sweep()` calls. | ||
| - CSRF and session cookies are now sent with `Secure` when | ||
| `NODE_ENV=production`. | ||
| - `connectPostgres` gained pool sizing (`max`), TLS enforcement (defaults to | ||
| `require` in production), and optional CA certs. | ||
| - Removed the per-request `[x][security] applied N header(s)` log line that | ||
| spammed stdout in production. | ||
|
|
||
| ### Fixed | ||
|
|
||
| - **Docker build was broken**: the `Dockerfile`/`DEPLOY.md` referenced | ||
| `dist/` while `x build` wrote `.x/`. The CLI now supports | ||
| `x build --outDir <dir>` (and `x start --outDir <dir>`), and the Dockerfile | ||
| builds with `--outDir dist`. The generated server entry is `index.ts`, not | ||
| `index.js` — both docs and the image `CMD` were updated to match. | ||
| - **Dockerfile didn't copy all workspace `package.json` files**, so | ||
| `bun install --frozen-lockfile` failed. It now copies every workspace's | ||
| manifest before installing. | ||
| - `examples/basic` and `examples/saas` auth opened a new SQLite connection and | ||
| re-ran migrations on **every** call. Both now use a module-level singleton | ||
| connection and run migrations once (creating the `data/` dir if missing). | ||
| - The `saas` template login form was non-functional (no handler). It now | ||
| submits to a real `POST` route with client-side feedback, matching the | ||
| `basic` template. | ||
|
|
||
| ### Docs | ||
|
|
||
| - Added `SECURITY.md`, `.env.example`, `CONTRIBUTING.md`, `CHANGELOG.md`, and | ||
| `CODE_OF_CONDUCT.md`. | ||
| - Templates' demo auth (hardcoded `admin`/`admin`) is now explicitly marked | ||
| DEMO ONLY in code and on the login pages. | ||
|
|
||
| ### CI | ||
|
|
||
| - Pinned the Bun version (`1.3.14`) instead of `latest` for reproducible | ||
| builds, added a Linux + macOS matrix, and a separate `bun audit` job. | ||
| - Added Dependabot configuration for weekly dependency updates. | ||
|
|
||
| ## 0.1.x — pre-release | ||
|
|
||
| See the git history for changes before this changelog existed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| # Contributor Covenant Code of Conduct | ||
|
|
||
| ## Our Pledge | ||
|
|
||
| We as members, contributors, and leaders pledge to make participation in our | ||
| community a harassment-free experience for everyone, regardless of age, body | ||
| size, visible or invisible disability, ethnicity, sex characteristics, gender | ||
| identity and expression, level of experience, education, socio-economic status, | ||
| nationality, personal appearance, race, caste, color, religion, or sexual | ||
| identity and orientation. | ||
|
|
||
| We pledge to act and interact in ways that contribute to an open, welcoming, | ||
| diverse, inclusive, and healthy community. | ||
|
|
||
| ## Our Standards | ||
|
|
||
| Examples of behavior that contributes to a positive environment for our | ||
| community include: | ||
|
|
||
| - Demonstrating empathy and kindness toward other people | ||
| - Being respectful of differing opinions, viewpoints, and experiences | ||
| - Giving and gracefully accepting constructive feedback | ||
| - Accepting responsibility and apologizing to those affected by our mistakes, | ||
| and learning from the experience | ||
| - Focusing on what is best not just for us as individuals, but for the overall | ||
| community | ||
|
|
||
| Examples of unacceptable behavior include: | ||
|
|
||
| - The use of sexualized language or imagery, and sexual attention or advances | ||
| of any kind | ||
| - Trolling, insulting or derogatory comments, and personal or political attacks | ||
| - Public or private harassment | ||
| - Publishing others' private information, such as a physical or email address, | ||
| without their explicit permission | ||
| - Other conduct which could reasonably be considered inappropriate in a | ||
| professional setting | ||
|
|
||
| ## Enforcement Responsibilities | ||
|
|
||
| Community leaders are responsible for clarifying and enforcing our standards of | ||
| acceptable behavior and will take appropriate and fair corrective action in | ||
| response to any behavior that they deem inappropriate, threatening, offensive, | ||
| or harmful. | ||
|
|
||
| Community leaders have the right and responsibility to remove, edit, or reject | ||
| comments, commits, code, wiki edits, issues, and other contributions that are | ||
| not aligned to this Code of Conduct, and will communicate reasons for | ||
| moderation decisions when appropriate. | ||
|
|
||
| ## Scope | ||
|
|
||
| This Code of Conduct applies within all community spaces, and also applies when | ||
| an individual is officially representing the community in public spaces. | ||
|
|
||
| ## Enforcement | ||
|
|
||
| Instances of abusive, harassing, or otherwise unacceptable behavior may be | ||
| reported to the community leaders responsible for enforcement at the email | ||
| address listed in the repository profile. All complaints will be reviewed and | ||
| investigated promptly and fairly. | ||
|
|
||
| All community leaders are obligated to respect the privacy and security of the | ||
| reporter of any incident. | ||
|
|
||
| ## Attribution | ||
|
|
||
| This Code of Conduct is adapted from the [Contributor Covenant][homepage], | ||
| version 2.1, available at | ||
| https://www.contributor-covenant.org/version/2/1/code_of_conduct.html. | ||
|
|
||
| [homepage]: https://www.contributor-covenant.org |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| # Contributing to x | ||
|
|
||
| Thanks for wanting to help. This is a small solo framework project, so a few | ||
| guidelines keep it reviewable and consistent. | ||
|
|
||
| ## Project layout | ||
|
|
||
| ``` | ||
| packages/core framework runtime (router, SSR/SSG, islands, server functions, data layer) | ||
| packages/cli x dev / x build / x start | ||
| packages/env type-safe env validation | ||
| packages/adapter-vercel Vercel Build Output API adapter | ||
| packages/create-thexjs-app `bun create thexjs-app@latest` scaffolder | ||
| examples/* dogfood apps (basic, blog, default, landing, saas) | ||
| ``` | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| - [Bun](https://bun.sh) 1.3.x or later | ||
| - Node.js is **not** used at any point in this repo | ||
|
|
||
| ## Setup | ||
|
|
||
| ```sh | ||
| bun install # builds all packages (postinstall) and links the CLI | ||
| ``` | ||
|
|
||
| ## Common commands | ||
|
|
||
| ```sh | ||
| bun run dev # builds packages, then runs examples/basic in dev | ||
| bun run build:packages | ||
| bun run typecheck # strict TS across every package + example | ||
| bun run lint # biome check . (bun run lint:fix to autofix) | ||
| bun test # all tests | ||
| bun test <path> # a single test file | ||
| ``` | ||
|
|
||
| ## Making changes | ||
|
|
||
| 1. Branch off `main` and give the branch a short, descriptive name. | ||
| 2. Make the change. Prefer small, focused commits; use the repo's commit style | ||
| (`feat:`, `fix:`, `docs:`, `chore:`). | ||
| 3. Add or update tests for anything in `packages/core` — every feature has a | ||
| test file next to its source (`*.test.ts`), run with `bun test`. | ||
| 4. Run `bun run lint`, `bun run typecheck`, and `bun test` before pushing. | ||
| CI runs the same three on both Ubuntu and macOS. | ||
| 5. If you change templates in `packages/create-thexjs-app/templates/*`, also | ||
| update the matching `examples/*` app so they stay in sync (they're kept as | ||
| parallel dogfood copies). | ||
|
|
||
| ## Code style | ||
|
|
||
| - **Biome** (double quotes, 2-space indent, semicolons, trailing commas). | ||
| - **TypeScript strict** — `strict`, `noUncheckedIndexedAccess`, | ||
| `exactOptionalPropertyTypes`, `verbatimModuleSyntax` (type-only imports must | ||
| use `import type`). | ||
| - No `any`. If a type is painful, cast narrowly with a comment explaining why. | ||
| - All packages are `"type": "module"`. | ||
|
|
||
| ## Testing | ||
|
|
||
| Tests use `bun:test`. Fixtures are created in `beforeAll` and cleaned up in | ||
| `afterAll` under `__fixtures__/`. Run one file with: | ||
|
|
||
| ```sh | ||
| bun test packages/core/src/router.test.ts | ||
| ``` | ||
|
|
||
| ## Conventions & gotchas | ||
|
|
||
| - **`src/x-routes.ts` and `.x/`** are generated — never edit them by hand. | ||
| - **Env isolation**: never read a non-`THEXJS_PUBLIC_` env var in client code; | ||
| the build fails if you do. | ||
| - **postinstall** builds all packages; if it fails, run `bun run build:packages`. | ||
|
|
||
| ## Code of conduct | ||
|
|
||
| Be respectful. This project follows the [Contributor Covenant][covenant] — see | ||
| `CODE_OF_CONDUCT.md`. | ||
|
|
||
| ## Questions | ||
|
|
||
| Open a discussion or an issue. For security issues, see `SECURITY.md` — do not | ||
| file a public issue. | ||
|
|
||
| [covenant]: https://www.contributor-covenant.org/ |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.