Skip to content

Commit

Permalink
[chore]: local setup
Browse files Browse the repository at this point in the history
- fix .env.example to be more verbose
- document the local setup
  • Loading branch information
sanam2405 committed May 22, 2024
1 parent 6f7b152 commit 3a317a8
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 67 deletions.
102 changes: 57 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,13 @@ Location-Sharing in a Geosocial Network </i>
## Privacy Filtration Logic

![](idea/high/privacyfiltrationtable.png)

![](idea/high/privacyfiltrationlogic.png)
![](idea/high/privacyfiltrationtwo.png)

## Privacy Network API Documentation

_[Privacy Network API Docs](https://privacynetwork.onrender.com/docs)_

<!-- _![OpenAPI Swagger API Docs](./idea/high/openapi.png)_ -->

### OpenAPI Swagger API Docs

_![OpenAPI Swagger API Docs](./idea/high/swaggeruser.png)_
Expand All @@ -41,51 +39,14 @@ _![OpenAPI Swagger API Docs](./idea/high/swaggeruser.png)_

_![OpenAPI Swagger Schemas](./idea/high/swaggerschema.png)_

<!--
### A. Registration - <i> User </i>
![](presentation/assets/registration.png)
### B. Registration - <i> LSSNS </i>
![](presentation/assets/regnlssn.png)
### C. <i> mSON </i> user login, authentication and key generation
![](presentation/assets/auth.png)
### D. <i> LSSNS </i> login, authentication and key generation
![](presentation/assets/authlssns.png)
### E. Distance threshold registration
![](presentation/assets/distanceregistration.png)
### F. User location update
![](presentation/assets/updatelocation.png)
### G. Friend's location query
![](presentation/assets/queryfriend.png) -->

### Login Page

<!-- ![](presentation/assets/Login_Speed.gif) -->

![](idea/gifs/Auth2.gif)

### Landing Page

<!-- ![](presentation/assets/Landing_Speed.gif) -->

![](idea/gifs/Dashboard.gif)

<!-- ![](presentation/assets/FriendsPage_Speed.gif) -->

<!-- ![](presentation/assets/Map_Speed.gif) -->

### Map Page: Real-Time Location Updation

![](<idea/gifs/Location%20update%20wrt%20Query%20(Fixed%20Position).gif>)
Expand All @@ -111,8 +72,6 @@ _![OpenAPI Swagger Schemas](./idea/high/swaggerschema.png)_
- Postgres with PostGIS
- Swagger

<!-- ![](presentation/assets/techstack.png) -->

## Setting up locally

The codebase is organized as :
Expand All @@ -129,6 +88,59 @@ The codebase is organized as :
cd PrivacyNetwork
```

- Configure the `.env` of the four servers

```bash
// ts-frontend

VITE_BACKEND_URI=<BACKEND_API_URI: ts-backend server address>
VITE_WS_URI=<WEBSOCKET_URI: ws WebSocket server address>
VITE_GOOGLE_API_KEY=<GOOGLE_MAPS_API_KEY: API KEY for Google map>
```

```bash
// ts-backend

GOOGLE_CLIENT=<GOOGLE_CLIENT_ID: for logging in with Google>
GOOGLE_API_KEY=<GOOGLE_API_KEY: for logging in with Google>
MONGO_URI=<MONGO_URI: for mongoDB database connection>
SECRET_KEY=<CLIENT_SECRET: for generating/verifying the JWT token>
PORT=<PORT: at which the ts-backend server runs>
LOCATION_BACKEND_URI=<LOCATION_BACKEND_URI: for location querying req to loc server>
BACKEND_INTERCOMMUNICATION_SECRET=<BACKEND_INTERCOMMUNICATION_SECRET: for backend intercommunication>
```
```bash
// loc

DATABASE_URL=<DATABASE_URI: for connecting to the Postgres instance of Supabase>
DIRECT_URL=<DIRECT_URL: for connection direct connection to Postgres instance of Supabase via ORM Prisma for migrations>
BACKEND_INTERCOMMUNICATION_SECRET=<BACKEND_INTERCOMMUNICATION_SECRET: for backend intercommunication>
```
```bash
// ws

SECRET_KEY=<CLIENT_SECRET: verifying the JWT token>
TS_BACKEND_URI=<TS_BACKEND_URI: for user auth from ts-backend>
```
- Database Seeding
```bash

// MongoDB Mock Data

backend/ts-backend/src/mockdata
└── MOCK_DATA.json

// Postgres Mock Data

backend/loc/src/mockdata
├── Location.sql
└── User.sql
```
- Run the frontend
```bash
Expand All @@ -137,23 +149,23 @@ The codebase is organized as :
npm run dev
```
- Run the express backend
- Run the MongoDB backend
```bash
cd backend/ts-backend
npm install
npm run dev
```
- Run the loc backend
- Run the Postgres backend
```bash
cd backend/loc
npm install
npm run dev
```
- Run the websocket backend
- Run the WebSocket backend
```bash
cd backend/ws
Expand Down
17 changes: 0 additions & 17 deletions backend/loc/.env.example
Original file line number Diff line number Diff line change
@@ -1,20 +1,3 @@
# Supabase admin password
ADMIN_PASSWORD=<ADMIN_PASSWORD: for admin loggin in to supabase>

# Connection through a frontend framework (React, Remix, SvelteKit, Astro, Vue)
SUPABASE_URI=<SUPABASE_URI: for Supabase database connection>
SUPABASE_KEY=<SUPABASE_KEY: for Supabase database connection>

# Connection string through a backend framework (Nodejs, Golang, JDBC, Python)
DATABASE_URL=<DATABASE_URI: for connecting to the Postgres instance of Supabase>

# Conneciton through ORMs (Prisma in this case)

# Connect to Supabase via connection pooling with Supavisor
DATABASE_POOL_URL=<DATABASE_URL: for connection pooling to Postgres instance of Supabase via ORM Prisma>

# Direct connection to the database. Used for migrations
DIRECT_URL=<DIRECT_URL: for connection direct connection to Postgres instance of Supabase via ORM Prisma for migrations>

# For backend - backend intercommunication
BACKEND_INTERCOMMUNICATION_SECRET=<BACKEND_INTERCOMMUNICATION_SECRET: for backend intercommunication>
4 changes: 2 additions & 2 deletions backend/ts-backend/.env.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
GOOGLE_CLIENT=<GOOGLE_CLIENT_ID: for logging in with Google>
GOOGLE_API_KEY=<GOOGLE_API_KEY: for logging in with Google>
MONGO_URI=<MONGO_URI: for mongoDB database connection>
SECRET_KEY=<CLIENT_SECRET: for hashing>
PORT=<PORT: at which the backend server runs>
SECRET_KEY=<CLIENT_SECRET: for generating/verifying the JWT token>
PORT=<PORT: at which the ts-backend server runs>
LOCATION_BACKEND_URI=<LOCATION_BACKEND_URI: for location querying req to loc server>
BACKEND_INTERCOMMUNICATION_SECRET=<BACKEND_INTERCOMMUNICATION_SECRET: for backend intercommunication>
3 changes: 2 additions & 1 deletion backend/ws/.env.example
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
SECRET_KEY=<CLIENT_SECRET: for hashing>
SECRET_KEY=<CLIENT_SECRET: verifying the JWT token>
TS_BACKEND_URI=<TS_BACKEND_URI: for user auth from ts-backend>
Binary file added idea/high/privacyfiltrationlogic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions ts-frontend/.env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
VITE_BACKEND_URI=<BACKEND_API_URI: backend server address>
VITE_WS_URI=<WEBSOCKET_URI: web socket address>
VITE_BACKEND_URI=<BACKEND_API_URI: ts-backend server address>
VITE_WS_URI=<WEBSOCKET_URI: ws WebSocket server address>
VITE_GOOGLE_API_KEY=<GOOGLE_MAPS_API_KEY: API KEY for Google map>

1 comment on commit 3a317a8

@vercel
Copy link

@vercel vercel bot commented on 3a317a8 May 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.