This document provides guidelines for AI coding agents working in the tinyauth repository.
This project is an OpenID Connect (OIDC) Provider implementation that provides OAuth2 and OIDC authentication services. It acts as an identity provider (IdP) that allows client applications to authenticate users and obtain identity information through standard OIDC flows.
- Full OAuth2 and OIDC protocol support
- Authorization Code Flow with PKCE
- Client credentials management
- Token issuance and validation (ID tokens, access tokens, refresh tokens)
- User authentication and consent management
- Multi-language support (Korean, English, Japanese)
This is a monorepo with the following packages:
packages/server- Fastify-based OAuth2/OIDC authentication serverpackages/frontend- React frontend using TanStack Router and Daisy UI
Example applications for testing OIDC flows:
examples/clients/nextjs-ssr- Next.js OIDC test client (server-side token handling)examples/clients/react-spa- React SPA OIDC test client (client-side PKCE flow)
pnpm dev # Start all packages in dev mode
pnpm build # Build all packages
pnpm test # Run all tests- Always include
.jsextension for local imports (ESM requirement) - No barrel exports: Import directly from the source file (exception:
packages/server/src/lib/config/index.tsserves as the public module boundary for@tinyrack/tinyauth-server/config)
- No type assertions or non-null assertions (
as,!)
- Files: kebab-case (e.g.,
user.entity.ts,auth-page-layout.tsx) - Classes: PascalCase (e.g.,
UserEntity,UserRepository) - Functions/Variables: camelCase
- Constants: UPPER_SNAKE_CASE
- Database columns: snake_case
- Use ESM modules (not CommonJS)
- Module resolution:
nodenext - Always use
.jsextensions in imports for local files
- Always use i18n for all user-facing text
- Use
react-i18nextwithuseTranslationhook - Translation files:
src/i18n/locales/{ko,en,ja}.json
After completing code changes, run:
pnpm build # Build check
pnpm test 2>&1 | tail -200 # Test check (use tail to avoid long output)
pnpm biome check . # Lint checkNote: Tests take a long time (~20 min). Always pipe test output through tail to see only the summary.
- This project is under active development and backward compatibility is not required.
- Feel free to make breaking changes without maintaining legacy support.
- Write descriptive commit messages
- Keep functions small and focused
- Use async/await (not callbacks)
- Validate all user input with Zod
- Type everything - avoid
any - Use descriptive variable names
- Follow DRY principles