Skip to content

Commit 292da6c

Browse files
authored
secret storage (#1447)
* secret storage * secret encryption * remove unused decorator, fix migration and tests * improve architecture * fix test runner * errors to constants * wait for health checks * fix redis tests * fix cassandra and redis tests * bigger instance * fix tests to handle readonly file system * fix flaky test * fix flaky tests * fix flaky tests * swagger, correct response type * reverse relations * missing file * proper types for this, coding conventions * audit dto fix * apibody guards, pagination dto * missing isArray
1 parent 4806ee2 commit 292da6c

File tree

66 files changed

+4470
-135
lines changed

Some content is hidden

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

66 files changed

+4470
-135
lines changed

.github/workflows/backend.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ on:
33
push:
44
branches:
55
- main
6-
paths:
7-
- "!frontend/**"
6+
paths-ignore:
7+
- "frontend/**"
88
pull_request:
9-
paths:
10-
- "!frontend/**"
9+
paths-ignore:
10+
- "frontend/**"
1111
jobs:
1212
test:
1313
runs-on:
14-
labels: ubuntu-latest-4-cores
14+
labels: ubuntu-latest-8-cores
1515
steps:
1616
- uses: actions/checkout@v3
1717
- uses: extractions/setup-just@v1
@@ -40,5 +40,3 @@ jobs:
4040
node-version: '18'
4141
- run: cd backend && yarn install
4242
- run: cd backend && yarn run lint
43-
44-

AGENTS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CLAUDE.md

CLAUDE.md

Lines changed: 129 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,132 @@
1-
# Claude Code Configuration
1+
# CLAUDE.md
22

3-
## Frontend Tests
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
RocketAdmin is a database administration panel that allows users to manage database connections, tables, and data. It consists of multiple components in a monorepo structure:
8+
9+
- **backend/** - NestJS API server (TypeScript, ES modules)
10+
- **frontend/** - Angular 19 web application (standalone components)
11+
- **rocketadmin-agent/** - NestJS agent for connecting to databases behind firewalls
12+
- **autoadmin-ws-server/** - WebSocket server for agent communication
13+
- **shared-code/** - Shared data access layer and utilities used by backend and agent
14+
15+
## Development Commands
16+
17+
### Backend
18+
19+
```bash
20+
cd backend
21+
yarn start:dev # Start dev server with hot reload
22+
yarn build # Build for production
23+
yarn lint # ESLint with auto-fix
24+
yarn test # Run non-saas AVA tests (serial)
25+
yarn test-all # Run all AVA tests (5min timeout, serial)
26+
yarn test-saas # Run SaaS-specific tests
27+
```
28+
29+
### Frontend
30+
31+
```bash
32+
cd frontend
33+
yarn start # Start Angular dev server
34+
yarn build # Production build
35+
yarn test:ci # Run tests headlessly (CI mode)
36+
yarn test --browsers=ChromeHeadlessCustom --no-watch --no-progress # Headless tests
37+
yarn lint # TSLint (deprecated, needs ESLint migration)
38+
```
39+
40+
### Running Backend Tests with Docker
41+
42+
The project uses `just` for test orchestration:
443

5-
To run frontend tests:
644
```bash
7-
cd frontend && yarn test --browsers=ChromeHeadlessCustom --no-watch --no-progress
8-
```
45+
just test # Run all backend tests with Docker Compose
46+
just test "path/to/test.ts" # Run specific test file
47+
```
48+
49+
This spins up test databases (MySQL, PostgreSQL, MSSQL, Oracle, IBM DB2, MongoDB, DynamoDB) via `docker-compose.tst.yml`.
50+
51+
### Migrations
52+
53+
```bash
54+
cd backend
55+
yarn build # Must build first
56+
yarn migration:generate src/migrations/MigrationName # Generate migration
57+
yarn migration:run # Run pending migrations
58+
yarn migration:revert # Revert last migration
59+
```
60+
61+
## Architecture
62+
63+
### Monorepo Structure
64+
65+
- Uses Yarn workspaces with packages: `backend`, `rocketadmin-agent`, `shared-code`
66+
- `shared-code` is imported as `@rocketadmin/shared-code` workspace dependency
67+
- Frontend is a separate Angular project (not a workspace member)
68+
69+
### Backend (NestJS)
70+
71+
- **Entities pattern**: Each entity has its own directory under `src/entities/` containing:
72+
- `*.entity.ts` - TypeORM entity
73+
- `*.module.ts` - NestJS module
74+
- `*.controller.ts` - REST endpoints
75+
- `*.service.ts` - Business logic (use cases)
76+
- `dto/` - Request/response DTOs with class-validator decorators
77+
- `*.controller.ee.ts` - Enterprise edition controllers (SaaS features)
78+
- **Guards**: Authentication and authorization in `src/guards/`
79+
- **Data access**: Uses `shared-code` for database operations via Knex
80+
- **Testing**: AVA test framework with tests in `test/ava-tests/`
81+
- `non-saas-tests/` - Core functionality tests
82+
- `saas-tests/` - SaaS-specific feature tests
83+
- `complex-table-tests/` - Complex table operation tests
84+
85+
### Frontend (Angular 19)
86+
87+
See `frontend/CLAUDE.md` for detailed frontend architecture.
88+
89+
Key points:
90+
- Standalone components (no NgModules)
91+
- BehaviorSubject-based state management (no NgRx)
92+
- Multi-environment builds (development, production, saas, saas-production)
93+
- Jasmine/Karma testing with ChromeHeadless
94+
95+
### Shared Code
96+
97+
Located in `shared-code/src/`:
98+
- `data-access-layer/` - Database abstraction supporting MySQL, PostgreSQL, MSSQL, Oracle, MongoDB, DynamoDB, IBM DB2, Cassandra, Elasticsearch
99+
- `knex-manager/` - Knex connection management
100+
- `caching/` - LRU cache utilities
101+
- `helpers/` - Shared utilities
102+
103+
### Agent Architecture
104+
105+
The rocketadmin-agent connects to databases in private networks:
106+
1. Agent runs inside customer's network
107+
2. Connects to `autoadmin-ws-server` via WebSocket
108+
3. Backend communicates with agent through WebSocket server
109+
4. Agent executes database queries and returns results
110+
111+
## Database Support
112+
113+
The application supports: MySQL, PostgreSQL, MongoDB, DynamoDB, Cassandra, OracleDB, MSSQL, IBM DB2, Elasticsearch, Redis
114+
115+
Database-specific DAOs are in `shared-code/src/data-access-layer/`.
116+
117+
## Testing Database Connections
118+
119+
Test databases are defined in `docker-compose.tst.yml`:
120+
- MySQL: `testMySQL-e2e-testing:3306`
121+
- PostgreSQL: `testPg-e2e-testing:5432`
122+
- MSSQL: `mssql-e2e-testing:1433`
123+
- Oracle: `test-oracle-e2e-testing:1521`
124+
- IBM DB2: `test-ibm-db2-e2e-testing:50000`
125+
- MongoDB: `test-mongo-e2e-testing:27017`
126+
- DynamoDB: `test-dynamodb-e2e-testing:8000`
127+
128+
## Coding Conventions
129+
130+
### Class Member Ordering
131+
132+
- Private methods must be placed at the end of the class, after all public methods

Dockerfile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ COPY frontend/.yarn /app/frontend/.yarn
88
RUN apt-get update && apt-get install -y \
99
git \
1010
&& rm -rf /var/lib/apt/lists/*
11-
RUN yarn install --immutable --network-timeout 1000000 --silent
11+
RUN --mount=type=cache,target=/root/.yarn YARN_CACHE_FOLDER=/root/.yarn yarn install --immutable --network-timeout 1000000 --silent
1212
COPY frontend/scripts /app/frontend/scripts
1313
COPY frontend/src /app/frontend/src
1414

@@ -40,13 +40,12 @@ COPY backend /app/backend
4040
COPY shared-code /app/shared-code
4141
COPY rocketadmin-agent /app/rocketadmin-agent
4242
COPY .yarn /app/.yarn
43-
RUN yarn install --network-timeout 1000000 --immutable --silent
43+
RUN --mount=type=cache,target=/root/.yarn YARN_CACHE_FOLDER=/root/.yarn yarn install --network-timeout 1000000 --immutable --silent
4444
RUN cd shared-code && ../node_modules/.bin/tsc
45-
RUN cd backend && yarn run nest build
45+
RUN cd backend && ../node_modules/.bin/tsc && yarn run nest build
4646
COPY --from=front_builder /app/frontend/dist/dissendium-v0 /var/www/html
4747
COPY frontend/nginx/default.conf /etc/nginx/sites-enabled/default
48-
49-
RUN chown -R appuser:appuser /app
48+
RUN mkdir -p /app/backend/node_modules/.cache && chown -R appuser:appuser /app/backend/node_modules/.cache
5049
RUN chown -R appuser:appuser /var/lib/nginx
5150
RUN chown -R appuser:appuser /var/log/nginx
5251
RUN chown -R appuser:appuser /run

0 commit comments

Comments
 (0)