mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 12:37:39 +00:00
commit WIP
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -103,3 +103,4 @@ load-test/output/*
|
||||
.nx/workspace-data
|
||||
.cursor/rules/nx-rules.mdc
|
||||
.github/instructions/nx.instructions.md
|
||||
.angular
|
||||
|
@@ -155,10 +155,9 @@ core_integration_test: core_integration_server_start core_integration_test_packa
|
||||
|
||||
.PHONY: core_lint
|
||||
core_lint:
|
||||
golangci-lint run \
|
||||
go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.3.1 run \
|
||||
--timeout 10m \
|
||||
--config ./.golangci.yaml \
|
||||
--out-format=github-actions \
|
||||
--concurrency=$$(getconf _NPROCESSORS_ONLN)
|
||||
|
||||
.PHONY: login_pull
|
||||
|
@@ -4,44 +4,12 @@ This is the ZITADEL Console Angular application.
|
||||
|
||||
## Development
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- Node.js 18 or later
|
||||
- pnpm (latest)
|
||||
|
||||
### Installation
|
||||
|
||||
```bash
|
||||
pnpm install
|
||||
```
|
||||
|
||||
### Proto Generation
|
||||
|
||||
The Console app uses **dual proto generation** with Turbo dependency management:
|
||||
|
||||
1. **`@zitadel/proto` generation**: Modern ES modules with `@bufbuild/protobuf` for v2 APIs
|
||||
2. **Local `buf.gen.yaml` generation**: Traditional protobuf JavaScript classes for v1 APIs
|
||||
|
||||
The Console app's `turbo.json` ensures that `@zitadel/proto#generate` runs before the Console's own generation, providing both:
|
||||
|
||||
- Modern schemas from `@zitadel/proto` (e.g., `UserSchema`, `DetailsSchema`)
|
||||
- Legacy classes from `src/app/proto/generated` (e.g., `User`, `Project`)
|
||||
|
||||
Generated files:
|
||||
|
||||
- **`@zitadel/proto`**: Modern ES modules in `login/packages/zitadel-proto/`
|
||||
- **Local generation**: Traditional protobuf files in `src/app/proto/generated/`
|
||||
- TypeScript definition files (`.d.ts`)
|
||||
- JavaScript files (`.js`)
|
||||
- gRPC client files (`*ServiceClientPb.ts`)
|
||||
- OpenAPI/Swagger JSON files (`.swagger.json`)
|
||||
|
||||
To generate proto files:
|
||||
|
||||
```bash
|
||||
pnpm run generate
|
||||
```
|
||||
|
||||
This automatically runs both generations in the correct order via Turbo dependencies.
|
||||
|
||||
### Development Server
|
||||
@@ -49,7 +17,7 @@ This automatically runs both generations in the correct order via Turbo dependen
|
||||
To start the development server:
|
||||
|
||||
```bash
|
||||
pnpm start
|
||||
nx run @zitadel/console:dev
|
||||
```
|
||||
|
||||
This will:
|
||||
@@ -62,7 +30,7 @@ This will:
|
||||
To build for production:
|
||||
|
||||
```bash
|
||||
pnpm run build
|
||||
nx run @zitadel/console:build
|
||||
```
|
||||
|
||||
This will:
|
||||
@@ -75,63 +43,10 @@ This will:
|
||||
To run linting and formatting checks:
|
||||
|
||||
```bash
|
||||
pnpm run lint
|
||||
nx run @zitadel/console:lint
|
||||
```
|
||||
|
||||
To auto-fix formatting issues:
|
||||
|
||||
```bash
|
||||
pnpm run lint:fix
|
||||
```
|
||||
|
||||
## Project Structure
|
||||
|
||||
- `src/app/proto/generated/` - Generated proto files (Angular-specific format)
|
||||
- `buf.gen.yaml` - Local proto generation configuration
|
||||
- `turbo.json` - Turbo dependency configuration for proto generation
|
||||
- `prebuild.development.js` - Development environment configuration script
|
||||
|
||||
## Proto Generation Details
|
||||
|
||||
The Console app uses **dual proto generation** managed by Turbo dependencies:
|
||||
|
||||
### Dependency Chain
|
||||
|
||||
The Console app has the following build dependencies managed by Turbo:
|
||||
|
||||
1. `@zitadel/proto#generate` - Generates modern protobuf files
|
||||
2. `@zitadel/client#build` - Builds the TypeScript gRPC client library
|
||||
3. `console#generate` - Generates Console-specific protobuf files
|
||||
4. `console#build` - Builds the Angular application
|
||||
|
||||
This ensures that the Console always has access to the latest client library and protobuf definitions.
|
||||
|
||||
### Legacy v1 API (Traditional Protobuf)
|
||||
|
||||
- Uses local `buf.gen.yaml` configuration
|
||||
- Generates traditional Google protobuf JavaScript classes extending `jspb.Message`
|
||||
- Uses plugins: `protocolbuffers/js`, `grpc/web`, `grpc-ecosystem/openapiv2`
|
||||
- Output: `src/app/proto/generated/`
|
||||
- Used for: Most existing Console functionality
|
||||
|
||||
### Modern v2 API (ES Modules)
|
||||
|
||||
- Uses `@zitadel/proto` package generation
|
||||
- Generates modern ES modules with `@bufbuild/protobuf`
|
||||
- Uses plugin: `@bufbuild/es` with ES modules and JSON types
|
||||
- Output: `login/packages/zitadel-proto/`
|
||||
- Used for: New user v2 API and services
|
||||
|
||||
### Dependency Management
|
||||
|
||||
The Console's `turbo.json` ensures proper execution order:
|
||||
|
||||
1. `@zitadel/proto#generate` runs first (modern ES modules)
|
||||
2. Console's local generation runs second (traditional protobuf)
|
||||
3. Build/lint/start tasks depend on both generations being complete
|
||||
|
||||
This approach allows the Console app to use both v1 and v2 APIs while maintaining proper build dependencies.
|
||||
|
||||
## Legacy Information
|
||||
|
||||
This project was originally generated with Angular CLI version 8.3.20 and has been updated over time.
|
||||
nx run @zitadel/console:lint:fix
|
@@ -86,7 +86,10 @@
|
||||
},
|
||||
"serve": {
|
||||
"builder": "@angular-devkit/build-angular:dev-server",
|
||||
|
||||
"options": {
|
||||
"port": 3001,
|
||||
"host": "0.0.0.0"
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"browserTarget": "console:build:production"
|
||||
|
@@ -23,16 +23,15 @@
|
||||
"@zitadel/client:build"
|
||||
]
|
||||
},
|
||||
"dev": {
|
||||
"dependsOn": [
|
||||
"generate"
|
||||
]
|
||||
},
|
||||
"docker:build": {
|
||||
"dependsOn": [
|
||||
"build"
|
||||
],
|
||||
"options": {
|
||||
"push": false,
|
||||
"tags": [
|
||||
"zitadel/console:latest"
|
||||
]
|
||||
}
|
||||
},
|
||||
"docker:run": {
|
||||
"options": {
|
||||
|
@@ -4,7 +4,7 @@
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
"dev": "next dev --port 3002 --host 0.0.0.0",
|
||||
"build": "next build",
|
||||
"build:login:standalone": "NEXT_PUBLIC_BASE_PATH=/ui/v2/login NEXT_OUTPUT_MODE=standalone next build",
|
||||
"start": "next start",
|
||||
|
10
docs/Dockerfile
Normal file
10
docs/Dockerfile
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
FROM nginx:1.29.0
|
||||
RUN touch /var/run/nginx.pid && \
|
||||
chown -R nginx:nginx /var/cache/nginx /var/run/nginx.pid
|
||||
USER nginx
|
||||
COPY --chown=nginx:nginx nginx.conf /etc/nginx/nginx.conf
|
||||
COPY --chown=nginx:nginx build /usr/share/nginx/html/docs
|
||||
EXPOSE 3003
|
||||
ENTRYPOINT ["nginx", "-c", "/etc/nginx/nginx.conf"]
|
||||
CMD ["-g", "daemon off;"]
|
@@ -1,8 +1,6 @@
|
||||
# ZITADEL-Docs
|
||||
|
||||
This website is built using [Docusaurus 2](https://v2.docusaurus.io/), a modern static website generator.
|
||||
|
||||
The documentation is part of the ZITADEL monorepo and uses **pnpm** and **Turbo** for development and build processes.
|
||||
This documentation page is built using [Docusaurus](https://docusaurus.io/).
|
||||
|
||||
## Quick Start
|
||||
|
||||
@@ -10,34 +8,28 @@ The documentation is part of the ZITADEL monorepo and uses **pnpm** and **Turbo*
|
||||
# From the repository root
|
||||
pnpm install
|
||||
|
||||
# Start development server (with Turbo)
|
||||
pnpm turbo dev --filter=zitadel-docs
|
||||
|
||||
# Or start directly from docs directory
|
||||
cd docs && pnpm start
|
||||
# Start development server
|
||||
nx run @zitadel/docs:start
|
||||
```
|
||||
|
||||
The site will be available at http://localhost:3000
|
||||
The site will be available at http://localhost:3003
|
||||
|
||||
## Available Scripts
|
||||
|
||||
All scripts can be run from the repository root using Turbo:
|
||||
All scripts can be run from the repository root
|
||||
|
||||
```bash
|
||||
# Development server with live reload
|
||||
pnpm turbo dev --filter=zitadel-docs
|
||||
|
||||
# Build for production
|
||||
pnpm turbo build --filter=zitadel-docs
|
||||
nx run @zitadel/docs:build
|
||||
|
||||
# Generate API documentation and configuration docs
|
||||
pnpm turbo generate --filter=zitadel-docs
|
||||
nx run @zitadel/docs:generate
|
||||
|
||||
# Lint and fix code
|
||||
pnpm turbo lint --filter=zitadel-docs
|
||||
nx run @zitadel/docs:lint
|
||||
|
||||
# Serve production build locally
|
||||
cd docs && pnpm serve
|
||||
nx run @zitadel/docs:serve
|
||||
```
|
||||
|
||||
## Add new Sites to existing Topics
|
||||
@@ -45,46 +37,3 @@ cd docs && pnpm serve
|
||||
To add a new site to the already existing structure simply save the `md` file into the corresponding folder and append the sites id int the file `sidebars.js`.
|
||||
|
||||
If you are introducing new APIs (gRPC), you need to add a new entry to `docusaurus.config.js` under the `plugins` section.
|
||||
|
||||
## Build Process
|
||||
|
||||
The documentation build process automatically:
|
||||
|
||||
1. **Downloads required protoc plugins** - Ensures `protoc-gen-connect-openapi` is available
|
||||
2. **Generates gRPC documentation** - Creates API docs from proto files
|
||||
3. **Generates API documentation** - Creates OpenAPI specification docs
|
||||
4. **Copies configuration files** - Includes configuration examples
|
||||
5. **Builds the Docusaurus site** - Generates the final static site
|
||||
|
||||
## Local Development
|
||||
|
||||
### Standard Development
|
||||
|
||||
```bash
|
||||
# Install dependencies
|
||||
pnpm install
|
||||
|
||||
# Start development server
|
||||
pnpm start
|
||||
```
|
||||
|
||||
### API Documentation Development
|
||||
|
||||
When working on the API docs, run a local development server with:
|
||||
|
||||
```bash
|
||||
pnpm start:api
|
||||
```
|
||||
|
||||
## Container Image
|
||||
|
||||
If you just want to start docusaurus locally without installing node you can fallback to our container image.
|
||||
Execute the following commands from the repository root to build and start a local version of ZITADEL
|
||||
|
||||
```shell
|
||||
docker build -f docs/Dockerfile . -t zitadel-docs
|
||||
```
|
||||
|
||||
```shell
|
||||
docker run -p 8080:8080 zitadel-docs
|
||||
```
|
||||
|
69
docs/nginx.conf
Normal file
69
docs/nginx.conf
Normal file
@@ -0,0 +1,69 @@
|
||||
worker_processes auto;
|
||||
|
||||
pid /tmp/nginx.pid;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
# Logging
|
||||
access_log off;
|
||||
error_log /dev/stderr warn;
|
||||
|
||||
# Performance
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
keepalive_timeout 65;
|
||||
keepalive_requests 1000;
|
||||
|
||||
# Compression
|
||||
gzip on;
|
||||
gzip_vary on;
|
||||
gzip_proxied any;
|
||||
gzip_min_length 256;
|
||||
gzip_comp_level 6;
|
||||
gzip_types
|
||||
text/plain
|
||||
text/css
|
||||
text/xml
|
||||
text/javascript
|
||||
application/javascript
|
||||
application/x-javascript
|
||||
application/json
|
||||
application/xml
|
||||
application/xml+rss
|
||||
font/ttf
|
||||
font/otf
|
||||
image/svg+xml;
|
||||
|
||||
server {
|
||||
listen 3003;
|
||||
server_name localhost;
|
||||
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
# Docusarus Routing
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
# Static Assets Caching
|
||||
location ~* \.(?:ico|css|js|gif|jpe?g|png|woff2?|eot|ttf|svg|map)$ {
|
||||
expires 1y;
|
||||
access_log off;
|
||||
add_header Cache-Control "public, immutable";
|
||||
}
|
||||
|
||||
# Optional: Explicit asset route
|
||||
location /assets/ {
|
||||
expires 1y;
|
||||
add_header Cache-Control "public, immutable";
|
||||
}
|
||||
}
|
||||
}
|
@@ -3,14 +3,11 @@
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"docusaurus": "docusaurus",
|
||||
"dev": "docusaurus start",
|
||||
"start": "docusaurus start",
|
||||
"start:api": "pnpm run generate && docusaurus start",
|
||||
"dev": "docusaurus start --port 3003 --host 0.0.0.0",
|
||||
"build": "docusaurus build",
|
||||
"swizzle": "docusaurus swizzle",
|
||||
"deploy": "docusaurus deploy",
|
||||
"clear": "docusaurus clear",
|
||||
"serve": "docusaurus serve",
|
||||
"write-translations": "docusaurus write-translations",
|
||||
"write-heading-ids": "docusaurus write-heading-ids",
|
||||
"ensure-plugins": "if [ ! -f \"protoc-gen-connect-openapi/protoc-gen-connect-openapi\" ]; then sh ./plugin-download.sh; fi",
|
||||
@@ -18,29 +15,12 @@
|
||||
"generate": "pnpm run generate:grpc && pnpm run generate:apidocs && pnpm run generate:configdocs && pnpm run ensure-plugins",
|
||||
"generate:grpc": "pnpm run ensure-plugins && buf generate ../proto",
|
||||
"generate:apidocs": "docusaurus gen-api-docs all",
|
||||
"generate:configdocs": "cp -r ../cmd/defaults.yaml ./docs/self-hosting/manage/configure/ && cp -r ../cmd/setup/steps.yaml ./docs/self-hosting/manage/configure/",
|
||||
"generate:configdocs": "cp -r ../apps/api/cmd/defaults.yaml ./docs/self-hosting/manage/configure/ && cp -r ../apps/api/cmd/setup/steps.yaml ./docs/self-hosting/manage/configure/",
|
||||
"generate:re-gen": "yarn generate:clean-all && pnpm generate",
|
||||
"generate:clean-all": "docusaurus clean-api-docs all",
|
||||
"postinstall": "sh ./plugin-download.sh",
|
||||
"clean": "rm -rf node_modules .artifacts .docusaurus .turbo protoc-gen-connect-openapi docs/apis/resources"
|
||||
},
|
||||
"nx": {
|
||||
"targets": {
|
||||
"generate": {
|
||||
"outputs": [
|
||||
"{projectRoot}/apis/resources/**"
|
||||
]
|
||||
},
|
||||
"build": {
|
||||
"outputs": [
|
||||
"{projectRoot}/build/**"
|
||||
],
|
||||
"dependsOn": [
|
||||
"generate"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@bufbuild/buf": "^1.14.0",
|
||||
"@docusaurus/core": "^3.8.1",
|
||||
|
32
docs/project.json
Normal file
32
docs/project.json
Normal file
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"name": "@zitadel/docs",
|
||||
"$schema": "../node_modules/nx/schemas/project-schema.json",
|
||||
"targets": {
|
||||
"generate": {
|
||||
"outputs": ["{projectRoot}/apis/resources/**"]
|
||||
},
|
||||
"start": {
|
||||
"dependsOn": ["generate"]
|
||||
},
|
||||
"build": {
|
||||
"outputs": ["{projectRoot}/build/**"],
|
||||
"dependsOn": ["generate"]
|
||||
},
|
||||
"dev": {
|
||||
"dependsOn": ["build"]
|
||||
},
|
||||
"docker:build": {
|
||||
"dependsOn": [
|
||||
"build"
|
||||
]
|
||||
},
|
||||
"docker:run": {
|
||||
"options": {
|
||||
"args": [
|
||||
"-p",
|
||||
"3003:3003"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
6
nx.json
6
nx.json
@@ -4,7 +4,11 @@
|
||||
"releaseTagPattern": "release/{projectName}/{version}",
|
||||
"groups": {
|
||||
"test": {
|
||||
"projects": ["@zitadel/login", "@zitadel/console", "@zitadel/api"],
|
||||
"projects": [
|
||||
"@zitadel/login",
|
||||
"@zitadel/console",
|
||||
"@zitadel/api"
|
||||
],
|
||||
"projectsRelationship": "fixed",
|
||||
"docker": {
|
||||
"skipVersionActions": true,
|
||||
|
@@ -10,11 +10,14 @@
|
||||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular-devkit/core": "~20.1.0",
|
||||
"@bufbuild/buf": "^1.55.1",
|
||||
"@changesets/cli": "^2.29.5",
|
||||
"@devcontainers/cli": "^0.80.0",
|
||||
"@nx/angular": "21.4.0-beta.5",
|
||||
"@nx/docker": "21.4.0-beta.5",
|
||||
"nx": "21.4.0-beta.5",
|
||||
"nx": "21.3.11",
|
||||
"sass": "1.64.1"
|
||||
}
|
||||
},
|
||||
"dependencies": {}
|
||||
}
|
4023
pnpm-lock.yaml
generated
4023
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user