Skip to content

PHILIPP111007/phils_network

Repository files navigation

Phils network v1.2.1

Minimalistic social network written using Django, FastAPI and React.

What supports this app

  • Accounts and adding friends. Each user has the opportunity to maintain their own blog, subscribe to other people and see their blogs.

  • Dark theme.

  • You can create a conversation and chat with friends.

  • Lazy loading of pages, posts and messages.

  • Markdown posts and messages support.

  • You can send and download files.

  • You can see your Ethereum wallet (you need to pass ethereum address and infura api key in user settings).

  • You can send ETH to your friends.

  • Message image preview in the chat.

  • You can add a photo to your account.

  • You can reply to messages.

  • You can take part in video conferences.

User Agreement (by using the Service, the User confirms that he/she has read and accepts the terms of this Agreement)


Have fun and if you want please leave feedback!

Technologies used

Production installation

docker-compose up

docker compose up --build

docker-compose run django python manage.py createsuperuser

Then go to http://0.0.0.0/
Go to http://0.0.0.0/admin_page/ to see django admin page
Go to http://0.0.0.0:8080/docs to see Swagger documentation

If you are hosting this site, then go to Front/react/src/data/constants.js and replace SERVER_HOST with your server IP

Tests

To run tests, use:

docker compose run -e TEST=1 --build fastapi pytest

# or

export TEST=1
cd Services/fastapi
pytest

# or

make test

Development installation

Using Makefile

make create_env
make test

make django
make fastapi
make react

Then go to http://localhost:3000/

Other

Postgres.

brew install postgresql@15
brew link postgresql@15
brew services run postgresql@15

createuser -s postgres
createdb postgres --owner=postgres --username=postgres
psql postgres --username=postgres

Redis.

brew install redis

Run redis server in the new terminal window (to use the chat).

redis-server

Install micromamba

brew install micromamba

Run setup.sh script to create venv, DB migrations, superuser and collect static files.

bash setup.sh

Activate micromamba enviroment.

micromamba activate phils_network

Phils_network supports gunicorn (with uvicorn async workers).

export DEVELOPMENT=1

cd Services/django

python manage.py migrate

bash gunicorn.sh

FastAPI:

export DEVELOPMENT=1

cd Services/fastapi

uvicorn app.main:app --host 0.0.0.0 --port 8000 --workers 1


See phils_network/Services/django/gunicorn.conf.py for more information about gunicorn configuration.

Then go to the frontend directory phils_network/Front/react/. Install npm packages.

npm install


By default, django server runs on the 0.0.0.0 host and 8080 port (see phils_network/Services/django/gunicorn.sh file). So make sure that SERVER_HOST and SERVER_PORT variables in the phils_network/Front/react/app/data/constants.js file are similar to your backend.

Create production frontend app.

VITE_DEVELOPMENT=1 npm run dev

Home page:

alt text


Chat page:

alt text


Video: