Comment on page
Project Structure
There are 2 recommend ways of structuring your project:
- 1.In a mono-repo approach - all the files will be structured in a single directory.
- 2.In a multi-repo approach - the files will be structured in two distinct directories - a
server
and aclient
one.
This approach makes it easy to structure your project based on your team's needs.
A possible structure for a mono-repo approach can be:
.
├── genezio.yaml
├── .genezioignore
├── server/
│ ├── .env
│ ├── models/
│ ├── node_modules/
│ ├── package.json
│ └── index.ts
└── client/
├── node_modules/
├── src/
├── build/
└── package.json
Generally, genezio commands should be executed at path where
genezio.yaml
is present.Hence, commands such as
genezio deploy
and genezio local
will be executed in the project's directory. Genezio is implementing the concept of workspaces, so you can add in the
genezio.yaml
the paths to the corresponding server and client directories:genezio.yaml
name: getting-started
region: us-east-1
language: ts
packageManager: npm
workspace:
backend: ./server
frontend: ./client
A possible structure for a multi-repo approach can be:
Server directory
.
└── server/
├── genezio.yaml
├── .genezioignore
├── .env
├── models/
├── node_modules/
├── package.json
└── index.ts
Client directory
.
└── client/
├── genezio.yaml
├── .genezioignore
├── node_modules/
├── src/
├── build/
└── package.json
In the
server
directory you can add the source code related to the backend. There you will create or modify the
genezio.yaml
configuration file. More details on the configuration options you can find in the YAML Configuration File. In the
client
directory you can add the source code related to the frontend. Usually, you will find the SDK saved here because conceptually the client needs to know how to call the backend methods. You can change the location where the SDK is saved in genezio.yaml
.In genezio, a backend is composed of one or multiple classes. A class contains a set of methods. The methods can be called either directly or by using the SDK that is automatically generated on deployment and when using the local environment. There are three types of methods:
Last modified 1mo ago