Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/dispatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:

- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v44
uses: tj-actions/changed-files@v47

- name: Generate Matrix from changed Workspaces
id: generate-matrix
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ jobs:

publish-npm:
name: Publish npm package (requires approval)
if: needs.prepare.outputs.PROJECT == 'phantom-api'
if: needs.prepare.outputs.PROJECT == 'phantom-api-client'
runs-on: ubuntu-latest
needs: [prepare, build]
environment: release # configure environment protection to require manual approval
Expand All @@ -91,10 +91,12 @@ jobs:
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
- name: Enable Corepack and Yarn 4
run: corepack enable && corepack prepare yarn@4.9.2 --activate
- name: Install dependencies
run: yarn install --immutable
- name: Build package
run: yarn workspace phantom-api build
run: yarn workspace ${{ needs.prepare.outputs.PROJECT }} build
- name: Publish to npm
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
Expand Down
94 changes: 47 additions & 47 deletions .pnp.cjs

Large diffs are not rendered by default.

15 changes: 11 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ COPY phantom-api-backend/ ./phantom-api-backend/
COPY admin-interface/ ./admin-interface/

# Build des projets nécessaires à l'image
ENV NODE_OPTIONS="--experimental-loader=./.pnp.loader.mjs"
# Utilise un chemin absolu pour le loader PnP, car les scripts workspace
# s'exécutent depuis le dossier du package (sinon ./ pointe vers le workspace)
ENV NODE_OPTIONS="--experimental-loader=/app/.pnp.loader.mjs"
RUN yarn workspace phantom-api-backend build \
&& yarn workspace admin-interface build

Expand Down Expand Up @@ -75,9 +77,13 @@ COPY --from=builder --chown=phantom:phantom /app/package.json ./package.json
RUN mkdir -p /app/data /app/logs && \
chown -R phantom:phantom /app/data /app/logs

# Install production dependencies (en root pour éviter les problèmes de permissions)
WORKDIR /app/phantom-api-backend
RUN npm install --production --omit=dev
# Enable corepack for yarn support
RUN corepack enable

# Install production dependencies using yarn (en root pour éviter les problèmes de permissions)
WORKDIR /app
ENV NODE_OPTIONS="--experimental-loader=/app/.pnp.loader.mjs"
RUN yarn workspaces focus phantom-api-backend --production

# Change ownership après installation
RUN chown -R phantom:phantom /app
Expand All @@ -89,4 +95,5 @@ EXPOSE 3000
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
CMD curl -f http://localhost:3000/health || exit 1

ENV NODE_OPTIONS="--experimental-loader=/app/.pnp.loader.mjs"
CMD ["node", "dist/index.js"]
27 changes: 15 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,27 @@
<img src="assets/logo-white-and-black.svg" alt="Phantom API Logo" width="220" />

<!-- Badges -->
<p>
<a href="https://github.com/salnika/phantom-api.dev/actions"><img src="https://img.shields.io/github/actions/workflow/status/salnika/phantom-api.dev/dispatch.yml?branch=main&label=CI" alt="CI Status"></a>
<a href="https://github.com/salnika/phantom-api.dev/releases/latest"><img src="https://img.shields.io/github/v/tag/salnika/phantom-api.dev?label=latest" alt="Latest Release"></a>
<a href="https://github.com/salnika/phantom-api.dev/blob/main/LICENSE"><img src="https://img.shields.io/github/license/salnika/phantom-api.dev?color=blue" alt="License"></a>
<img src="https://img.shields.io/badge/node-%3E=20.0.0-green.svg" alt="Node.js Version">
<img src="https://img.shields.io/badge/yarn-4.9.2-2c8ebb.svg" alt="Yarn">
<a href="https://www.npmjs.com/package/phantom-api-client"><img src="https://img.shields.io/npm/v/phantom-api-client.svg?label=client" alt="npm version"></a>
<a href="https://hub.docker.com/r/salnika/phantom-api.dev"><img src="https://img.shields.io/docker/v/salnika/phantom-api.dev?sort=semver&label=backend" alt="Docker image version"></a>
</p>
<table>
<tr>
<td><a href="https://github.com/salnika/phantom-api.dev/releases/latest"><img src="https://img.shields.io/github/v/tag/salnika/phantom-api.dev?label=latest" alt="Latest Release"></a></td>
<td><a href="https://www.npmjs.com/package/phantom-api-client"><img src="https://img.shields.io/npm/v/phantom-api-client.svg?label=client" alt="npm version"></a></td>
<td><a href="https://hub.docker.com/r/salnika/phantom-api.dev"><img src="https://img.shields.io/docker/v/salnika/phantom-api.dev?sort=semver&label=backend" alt="Docker image version"></a></td>
</tr>
<tr>
<td><a href="https://hub.docker.com/r/salnika/phantom-api.dev"><img src="https://img.shields.io/badge/Docket-you_like-blue" alt="Docker"></a></td>
<td colspan="3"><a href="https://github.com/salnika/phantom-api.dev/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue" alt="License"></a></td>
</tr>
</table>
</div>

# Phantom API - Self-Generating Backend

A dynamic backend system that automatically creates API endpoints, database tables, and validation schemas based on api call from frontend.

- [Website](https://phantom-api.dev)
- [github](https://github.com/Salnika/phantom-api.dev)
- [Complete Documentation](https://salnika.github.io/phantom-api.dev/)

## Features

- **Dynamic API**: Single route `/api/:resource/:action` handles all operations
Expand All @@ -42,9 +48,6 @@ A dynamic backend system that automatically creates API endpoints, database tabl
│ └── data/ # SQLite database files
├── admin-interface/ # admin (React admin panel)
├── phantom-api/ # client (NPM package for frontend integration)
├── demo/ # Vite React demo application
├── website/ # Marketing website
├── public-doc/ # MkDocs documentation
├── ecosystem.config.js # PM2 process configuration
├── Dockerfile # Backend containerization
└── docker-compose.yml # Multi-service orchestration
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"dotenv": "^17.0.1",
"knip": "^5.61.3",
"oxlint": "^1.0.0",
"phantom-api": "workspace:*",
"phantom-api-client": "workspace:*",
"syncpack": "^13.0.4",
"typedoc": "^0.28.7",
"typedoc-plugin-markdown": "^4.7.0",
Expand Down Expand Up @@ -41,4 +41,4 @@
"admin-interface",
"public-doc"
]
}
}
Loading