Skip to content

Commit

Permalink
chore: split backend into server/api and server/shared (activepieces#…
Browse files Browse the repository at this point in the history
…3931)

* chore: split backend into server/api and server/shared

* chore: create worker package

* fix: remove sandboxed from .env
  • Loading branch information
abuaboud authored Feb 15, 2024
1 parent 27b22fa commit 3b271dd
Show file tree
Hide file tree
Showing 580 changed files with 16,474 additions and 7,888 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/codespaces.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ gh codespace ports visibility 3000:public -c $CODESPACE_NAME
gh codespace ports visibility 4200:public -c $CODESPACE_NAME
export BACKEND_URL=$(gh codespace ports -c $CODESPACE_NAME --json sourcePort,browseUrl | jq -r '.[] | select(.sourcePort == 3000) | .browseUrl')
sed -i "s|apiUrl: 'http://localhost:3000/v1'|apiUrl: '${BACKEND_URL}/v1'|g" /workspace/packages/ui/common/src/lib/environments/environment.ts
sed -i "s|AP_WEBHOOK_URL=\"http://localhost:3000\"|AP_WEBHOOK_URL=\"${BACKEND_URL}\"|g" /workspace/packages/backend/.env
sed -i "s|AP_WEBHOOK_URL=\"http://localhost:3000\"|AP_WEBHOOK_URL=\"${BACKEND_URL}\"|g" /workspace/packages/server/api/.env
2 changes: 1 addition & 1 deletion .github/workflows/build-cloud-nx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
parallel-commands-on-agents: |
npx nx affected --target=lint --parallel=3
npx nx affected --target=build -c production --parallel=3
npx nx run-many --target=test --projects=engine,shared,backend --parallel=3
npx nx run-many --target=test --projects=engine,shared,server-api --parallel=3
agents:
name: Nx Cloud - Agents
Expand Down
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ tmp
.nx/
/out-tsc
firebase-admin-sdk.json
cache
dev

# SDK Build
Expand Down Expand Up @@ -49,7 +48,6 @@ Thumbs.db
.angular
activepieces-engine.js
.history/
packages/backend/.env

# produced by unsandboxed engine execution
.pnpm-store
Expand All @@ -61,4 +59,3 @@ packages/backend/.env
scratch.md

# environment variables
.env
2 changes: 1 addition & 1 deletion .husky/commit-msg
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
. "$(dirname -- "$0")/_/husky.sh"

# Check if the commit includes changes to the backend's .env file
if git diff --cached --name-only -- packages/backend/.env | grep -q '^packages/backend/.env$'; then
if git diff --cached --name-only -- packages/server/api/.env | grep -q '^packages/server/api/.env$'; then
echo "Error: You're attempting to commit the backend's .env file. Please avoid committing this file."
exit 1
fi
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,18 @@ COPY . .
COPY .npmrc package.json package-lock.json ./
RUN npm ci

RUN npx nx run-many --target=build --projects=backend,ui-core --configuration production --skip-nx-cache
RUN npx nx run-many --target=build --projects=server-api,ui-core --configuration production --skip-nx-cache

# Install backend production dependencies
RUN cd dist/packages/backend && npm install --production --force
RUN cd dist/packages/server/api && npm install --production --force

### STAGE 2: Run ###
FROM base AS run

# Set up backend
WORKDIR /usr/src/app

COPY packages/backend/src/assets/default.cf /usr/local/etc/isolate
COPY packages/server/api/src/assets/default.cf /usr/local/etc/isolate

# Install Nginx and gettext for envsubst
RUN apt-get update && apt-get install -y nginx gettext
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Copyright (c) 2020-2024 Activepieces Inc.

Portions of this software are licensed as follows:

* All content that resides under the "packages/ee/" and "packages/backend/src/app/ee/" directory of this repository, if that directory exists, is licensed under the license defined in packages/ee/LICENSE
* All content that resides under the "packages/ee/" and "packages/server/api/src/app/ee" directory of this repository, if that directory exists, is licensed under the license defined in packages/ee/LICENSE
* All third party components incorporated into the Activepieces Inc Software are licensed under the original license provided by the owner of the applicable component.
* Content outside of the above mentioned directories or restrictions above is available under the "MIT Expat" license as defined below.

Expand Down
2 changes: 1 addition & 1 deletion docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
nginx -g "daemon off;" &

# Start backend server
node --enable-source-maps dist/packages/backend/main.js
node --enable-source-maps dist/packages/server/api/main.js
2 changes: 1 addition & 1 deletion docs/about/license.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Activepieces' **core** is released as open source under the [MIT license](https:

The MIT license is a permissive license that grants users the freedom to use, modify, or distribute the software without any significant restrictions. The only requirement is that you include the license notice along with the software when distributing it.

Using the enterprise features (under the packages/ee and packages/backend/src/app/ee folder) with a self-hosted instance requires an Activepieces license. If you are looking for these features, contact us at [[email protected]](mailto:[email protected]).
Using the enterprise features (under the packages/ee and packages/server/api/src/app/ee folder) with a self-hosted instance requires an Activepieces license. If you are looking for these features, contact us at [[email protected]](mailto:[email protected]).

**Benefits of Dual Licensing Repo**

Expand Down
4 changes: 2 additions & 2 deletions docs/developers/architecture/repo-structure.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The repository is structured as a monorepo using the NX build system, with TypeS
.
├── packages
│ ├── ui
│ ├── backend
│ ├── server
| ├── ee
│ ├── engine
│ ├── pieces
Expand All @@ -18,7 +18,7 @@ The repository is structured as a monorepo using the NX build system, with TypeS
```

- `ui`: This package contains the user interface, implemented using the Angular framework.
- `backend`: This package contains the API implementation, using the Fastify framework.
- `server`: This package contains the API implementation, using the Fastify framework.
- `ee`: This package contains features that are only available in the paid edition.
- `engine`: This package contains the logic for flow execution within the sandbox.
- `pieces`: This package contains the implementation of triggers and actions for third-party apps.
Expand Down
2 changes: 1 addition & 1 deletion docs/developers/building-pieces/create-action.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export const gelato = createPiece({

# Testing

By default, the development setup only builds specific components. Open the file `packages/backend/.env` and include "gelato" in the `AP_DEV_PIECES`.
By default, the development setup only builds specific components. Open the file `packages/server/api/.env` and include "gelato" in the `AP_DEV_PIECES`.

For more details, check out the [Piece Development](../development-setup/getting-started) section.

Expand Down
2 changes: 1 addition & 1 deletion docs/developers/building-pieces/create-trigger.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export const gelato = createPiece({

# Testing

By default, the development setup only builds specific components. Open the file `packages/backend/.env` and include "gelato" in the `AP_DEV_PIECES`.
By default, the development setup only builds specific components. Open the file `packages/server/api/.env` and include "gelato" in the `AP_DEV_PIECES`.

For more details, check out the [Piece Development](../development-setup/getting-started) section.

Expand Down
2 changes: 1 addition & 1 deletion docs/developers/development-setup/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ To set up the development environment, you can choose one of the following metho

To avoid making the dev environment slow, not all pieces are functional during development at first. By default, only these pieces are functional at first, as specified in `AP_DEV_PIECES`.

(https://github.com/activepieces/activepieces/blob/main/packages/backend/.env#L4
https://github.com/activepieces/activepieces/blob/main/packages/server/api/.env#L4

To override the default list available at first, define an `AP_DEV_PIECES` environment variable with a comma-separated list of pieces to make available. For example, to make `google-sheets` and `cal-com` available, you can use:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ To make your webhook accessible from the internet, you need to configure the bac

1. Install ngrok.
2. Run the command `ngrok http 3000`.
3. Replace the `AP_WEBHOOK_URL` environment variable in `packages/backend/.env` with the ngrok URL.
3. Replace the `AP_WEBHOOK_URL` environment variable in `packages/server/api/.env` with the ngrok URL.

Once you have completed these configurations, you are good to go!

Expand Down
Loading

0 comments on commit 3b271dd

Please sign in to comment.