unoffical wafrn mirror
wafrn.net
atproto
social-network
activitypub
1# Developing wafrn
2
3## Project Structure
4
5Wafrn is split between an [Angular](https://angular.dev) frontend and a [NodeJS](https://nodejs.org/en) backend.
6
7```text
8packages/
9├── frontend/
10│ ├── routes/
11│ ├── util/
12│ ├── README.md
13│ └── ...
14└── backend/
15 ├── src/
16 │ ├── app/
17 │ ├── assets/
18 │ └── ...
19 ├── README.md
20 └── ...
21```
22
23(Tree made with [tree.nathanfriend.io](https://tree.nathanfriend.io/))
24
25## Contributing
26
27If you would like to help develop the Frontend or Backend, read the README.md of the respective package.
28
29- [Frontend - README.md](../packages/frontend/README.md)
30- [Backend - README.md](../packages/backend/README.md)
31
32## Local setup pointing to the production frontend
33
34If you want to do development on the frontend and what you do does not require doing something like posting a lot or spaming an external account, you can simply:
35
361. Clone the repo
372. Install node 24 or use the provided Nix shell script
383. Run `npm install` at the root of the project
394. Run `npm run frontend:develop:prod`
40
41If you want to point to a different backend or see additional information on the nix shells script, see the Frontend README file.
42
43## Local setup with a local dummy instance
44
45If you want to develop Wafrn frontend but require to do more "noisy" stuff, you can point it at a working instance. See [Frontend - README.md](../packages/frontend/README.md) for more details
46
47If you want to setup both the backend and frontend locally there are a couple of helper scripts that can help you set up a local environment:
48
491. Run `./install/env_local_setup.sh`. This will setup the backend and frontend environment files to point to each other locally.
50
512. Run `docker compose up`. This will start up the required services: PostgreSQL, Redis and Caddy
52
53> **Note:** If you're not a fan of docker, or you already have these services running, you can also install PostgreSQL, Redis and Caddy manually.
54
55> **Note:** If you are running Caddy manually, or you are not using Docker Desktop but a more native docker installation, you will need to edit `packages/frontend/Caddyfile` and replace `host.docker.internal` with `localhost` for it to work properly.
56
573. Set up the the backend:
58
59```sh
60cd packages/backend
61npm i
62npm run db:migrate
63```
64
654. Set up the frontend:
66
67```sh
68cd packages/frontend
69npm i
70npm exec -- ng build --configuration=devlocal
71```
72
735. Start backend & frontend
74
75```sh
76cd packages/backend
77NODE_TLS_REJECT_UNAUTHORIZED=0 npm start
78```
79
80```sh
81cd packages/frontend
82npm exec -- ng serve --host 0.0.0.0 --configuration=devlocal
83```
84
856. If all is well go to `https://localhost` to see your app
86
87The default username/password for local installation is: `admin@example.com` / `Password1!`
88
89> **Note:** You can run `caddy trust` to install Caddy's root certificates, to the system store. This will remove the security warnings from your browser. You can also do `caddy untrust` once you're finished with the development.
90
91> **Warning:** Due to how the Fediverse and Bluesky operates not all features will be accessible when developing the backend locally. You might [want to host your own Wafrn instance](./deployment.md) as a staging server if you wish to develop features that require proper access to the Fediverse and/or Bluesky
92
93## Fullstack development with debugger
94
95Ok so you definetively need to do some backend stuff! As long as you do not need to do fedi stuff and bluesky stuff, it's easy!
96
971. Clone the repo
982. Install docker and node 24
993. Do this command on the root of the project `npm install`
1004. Copy the docker compose for local development `cp docker-compose.localBackendDebuggerDev.yml docker-compose.yml`
1015. Copy the development environment file for backend `cp packages/backend/environment.dev.ts packages/backend/environment.ts`
1026. Start the services required for wafrn to work: redis, postgres, and a db admin tool on https://localhost:8080 (type postgres, user and pass: root, db: wafrn) `docker compose up -d`
1037. Check that you can connect to the database in your browser in https://localhost:8080 . If you have problem here, contact the dev team
1048. Edit the environment file. Replace adminEmail and adminUser with youur desired email, user and password
1059. Do this command to initialize the database `cd packages/backend && npm run db:migrate`
10610. On the root directory, do this command to start the backend server: `npm run backend:develop`
10711. Do this command to start the frontend `npm run frontend:develop:prod`
10812. Enjoy!
109
110### Fullstack development with fedi and bluesky access and debugger access
111
112This part of the guide needs to be written properly, BUTT, the QUICK AND DIRTY explanation for this is:
113
114Execute the steps of "Fullstack development with debugger"
115
116You will require a VPS with caddy and a bluesky PDS and a domain
117
118Update the config on environment.ts:
119You will need to update: frontendUrl, instanceUrl, mediaUrl, externalCacheurl, email things too probably (optional), and if you want buesky too: enableBsky, bskyPds, bskyPdsJwtSecret, bskyPdsAdminPassword
120
121Once you do that and have stuff runing, to listen to the bluesky pds you will also need to start the atproto listener
122
123`npm run backend:atproto`
124
125Regarding fedi, you will need to create a reverse proxy with the url of the instance pointing to your machine. What I do is that i use the vps as a jump like this:
126
127`ssh -R 3002:localhost:3002 USER@YOURVPS`
128
129This will "mirror" your port 3002 to the internal port 3002 of your vps. You can reverse proxy that one.