ZenEstate

This is an installation and setup guide for ZenEstate v1.0 on macOS - a self-hosted real estate listing and marketplace platform with a flexible architecture that can be freely extended to include web

Note: This installation process is meant for more advanced users with some programming experience

Minimum Requirements:

- macOS or Linux based 64 bit operating system

- 4 GB RAM minimum

- Intel Core i3 or equivalent dual core processor

Installation pre-requisites:

Before we setup ZenEstate, we have to install the necessary pre-requisites which the web application needs in order to successfully start. You may skip some of these steps, if you already have the pre-requisites installed from our Sambot guide.

PostgreSQL

This is a SQL database, which ZenEstate uses to store user information & related property and billing data. As ZenEstate is self-hosted, you will own all of the stored data and its contents are never synchronized outside of your self-hosting container.

1. There are several ways to install PostgreSQL 16, however we recommend using the installer from the EDB website: https://www.enterprisedb.com/downloads/postgres-postgresql-downloads. Choose your operating system and proceed with the PostgreSQL installation.

2. (Optional) This is an optional step, however this tutorial will refer to it often. If you are an advanced user, you may skip this step. To interact with PostgreSQL, we can use pgAdmin which is a PostgreSQL management tool. This will allows us to create new databases, manage tables as well as view any of the stored data using a Graphical User Interface. The tool should be included if you used the EDB installation package, however if it is not available for some reason then you may install pgAdmin using the official link: https://www.pgadmin.org/

Now that we have the database and pgAdmin, we can start creating a local database. Note: if you are planning to self-host on a server then we recommend hosting your PostgreSQL in a separate server container.

1. Initiate PostgreSQL after installation in a previous step by searching for Postgres.app on macOS and running it

2. Initiate pgAdmin and proceed with the initial setup instructions

3. In pgAdmin, on the left panel, you should have a list of servers.

1. Right click on servers and register a new server.

2. Under the General tab, you may name the new server however you want.

3. Under the Connection tab, you will fill out the following information:

1. host: localhost

2. port: 5432

3. maintenance database: postgres

4. username: postgres

5. You may leave other fields blank as this is a self-hosting tutorial on your local machine. However, we do recommend setting up a password as well for any server based setup.

6. Click on Save

4. Unpack the new server you created on the left panel and create a new database under "Databases"

1. Right click on Databases and click on "Create"

2. Under the General tab, fill in "zenestate_local" as the database name

3. Click on Save

5. Now you should have a new local server, which contains a new database called "zenestate_local" on port 5432 if you have followed the instructions above.

NodeJS

NodeJS is an environment which will be required for self-hosting the frontend part of ZenEstate. You can follow the official website to install NodeJS (https://nodejs.org/en/download/package-manager/current). Once your NodeJS instance is installed, you will need to install the `pnpm` package manager via `npm` by running the following command in your terminal:

```

npm install -g pnpm

```

AWS S3 Bucket

ZenEstate uses S3 buckets to store user uploaded images of real estate properties. To setup S3, head to the official website (https://aws.amazon.com/s3/) to register and create your first S3 bucket. Once you obtain the access key ID and secret key, store these somewhere as we will be referring to them later. Make sure to also note the name of your bucket (can be arbitrarily named by you).

Google Maps Platform

ZenEstate uses Google Maps Platform API to determine the search location of user queries as well as to accurately list the properties. To get started, visit the official website to register and retrieve an API token (https://developers.google.com/maps).

Social Authentication

ZenEstate has an OAuth 2.0 social authentication layer built in to make onboarding your users much easier. To utilise these features, you can follow the Google guide (https://developers.google.com/identity/protocols/oauth2) and Facebook guide (https://developers.facebook.com/docs/facebook-login). Upon securing the Client ID and Client Secret, store these variables as they will be useful in the Setup section.

ZenEstate Setup

Now that we have all the pre-requisites installed, we can dive into the ZenEstate setup for both, the Frontend and the Backend applications.

1. Visit zenestate.samurai.financial and scroll to the bottom of the website to initiate a download for your chosen platform. If you cannot see any download buttons, you will want to either switch to the same wallet that purchased the on-chain license or you haven't purchased your licensed yet.

2. You will have to sign a message (this does not cost any FTM tokens and is completely free) using the same wallet that purchased the license. This cryptographically signed message is verified to ensure that the wallet truly owns an on-chain license before issuing a download.

3. Once you have the downloaded zip file on your chosen platform, unzip it into a folder.

4. Open the folder, and you will see 2 folders.

1. zenestate-frontend

2. zenestate-backend

Backend

1. Navigate to the zenstate-backend folder first

2. Using a Text Editor, open the `env.example` file in the zenestate-backend folder. You should see the following text:

```

NODE_ENV=production

PORT=3000

FE_PORT=8000

BE_BASE_URL=localhost

FE_BASE_URL=localhost

DB_HOST=localhost

DB_PORT=5432

DB_USER=postgres

DB_PASSWORD=

DB_NAME=zenestate-local

S3_BUCKET=

S3_ACCESS_KEY=

S3_SECRET_KEY=

CLIENT_ID_GOOGLE=

CLIENT_SECRET_GOOGLE=

CLIENT_ID_FACEBOOK=

CLIENT_SECRET_FACEBOOK=

JWT_ACCESS_PUBLIC_KEY=

JWT_ACCESS_PRIVATE_KEY=

JWT_REFRESH_PUBLIC_KEY=

JWT_REFRESH_PRIVATE_KEY=

JWT_REFRESH_TKN_AGE=846000 # in seconds

TZ="UTC"

```

3. Paste the AWS S3 Access Key ID into `S3_ACCESS_KEY` and Secret Key into `S3_SECRET_KEY`, and lastly paste the name of your bucket into `S3_BUCKET`.

4. Paste the Client ID and Client Secret from each of the Social Authentication providers into `CLIENT_ID_GOOGLE`, `CLIENT_SECRET_GOOGLE`, `CLIENT_ID_FACEBOOK`, and `CLIENT_SECRET_FACEBOOK`.

5. Paste the values of your encryption keys for JWT. The keys can be generated by `ssh-keygen` or any other tool that will generate RSA public/private key pairs.

6. (Optional) You may adjust other values, such as `JWT_REFRESH_TKN_AGE` which refers to the validity length of the JWT issued tokens from the backend upon logging in successfully with any of the OAuth 2.0 providers.

7. Ensure that none of the above values are leaked or shared anywhere and that they are securely kept.

8. (Optional) If you are running an instance of PostgreSQL anywhere else, please adjust the variables starting with `DB_` to their appropriate values.

9. Save the env.example file using your text editor

10. Rename the `env.example` file to `.env`. On macOS, any files which begin with a dot are automatically hidden. To unhide these files, press **Command + Shift + Dot**.

11. Double click on `zenestate-be-launch` and a terminal window should appear.

12. If all values are green, then you have managed to successfully setup ZenEstate and may begin interacting with it via a REST API or move onto the next step to setup the frontend.

Frontend

The frontend application is in the form of a direct project source code in TypeScript, that you may take and self-host on PaaS such as Vercel. This grants you the power of arbitrarily extending the application code to any new features and to host it on any NextJS compatible platform of your choice.

1. Navigate to the zenstate-frontend folder

2. Using a Text Editor, open the `env.example` file in the zenestate-frontend folder. You should see the following text:

```

NODE_ENV=production

NEXT_PUBLIC_GOOGLE_MAPS_API=

NEXT_PUBLIC_BACKEND_URL=http://localhost:3000/api/v1

```

3. Fill in the Google Maps API token that you have retrieved from the previous pre-setup steps.

4. Ensure that this key is not leaked nor shared anywhere and ensure that it is kept securely.

5. Save the env.example file using your text editor

6. Rename the `env.example` file to `.env`. On macOS, any files which begin with a dot are automatically hidden. To unhide these files, press **Command + Shift + Dot**.

7. Using `pnpm`, run `pnpm install`

8. To run in production, use these commands sequentially `pnpm build` & `pnpm start`

9. (Optional) if you wish to run the project in development, use the `pnpm dev` command

10. You should see that the server has started successfully on port `8000` and may begin using ZenEstate

In case of needed troubleshooting, you may reach out via Discord for further technical help.

Last updated