Skip to content

Latest commit

 

History

35 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Django React Full-Stack Banner

django-react

Ready to build Fullstack Template Django REST backend + React/Vite frontend.

image image
back/            Django project
  config/           settings, root urls
  apps/pages/       the page builder: page tree, fields, records (all rules live here)
  apps/<name>/      users, dashboard, visitors, core
front/           React + TypeScript + Vite
bot/             Telegram bot (python-telegram-bot) + visitor alerts

Backend

cd back
python -m venv .venv && source .venv/bin/activate   # Windows: .venv\Scripts\activate
pip install -r requirements.txt
cp .env.example .env                                 # set SECRET_KEY
python manage.py migrate
python manage.py ensure_superuser                    # login account from SUPERUSER_* in .env
python manage.py seed                                # optional: demo Users row from ADMIN_* in .env
python manage.py runserver                           # http://localhost:8000

Login. Every page and API call needs a login. ./run-app.sh creates the superuser from SUPERUSER_USERNAME / SUPERUSER_PASSWORD in back/.env on first start (default admin / admin12345, change it before going live). Use it at /login and /admin/. It's created once and never overwritten: change the password with python manage.py changepassword admin.

API: /api/auth/login/, /api/auth/me/, /api/pages/, /api/uploads/<id>/, /api/fields/, /api/records/, /api/schema/, /api/users/, /api/dashboard/, /api/visits/, /api/health/ · Admin: /admin/

Pages you build in the browser

No screen is hard-coded. Create a page (+ New page), give it fields (text, number, date, dropdown, link to a record on another page, ...) with rules (required, min/max, regex, unique, ...), then fill it with records. Any page can hold sub-pages, and those can hold their own, with no depth limit: the sidebar shows the tree, each page shows its branches and breadcrumbs.

The backend owns every rule: it cleans and validates each value, numbers records, keeps link titles in step, searches, sorts (numbers as numbers), exports CSV, refuses moves that would put a page inside itself and deletes that would leave links pointing at nothing. The frontend only draws what it gets. See back/README.md.

Frontend

cd front
npm install
cp .env.example .env
npm run dev                                          # http://localhost:1212

Telegram bot

cd bot
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env                                 # set BOT_TOKEN, ADMIN_ID, BOT_API_KEY
python bot.py                                        # the bot itself
python visitor.py                                    # optional: website visits -> your Telegram

See bot/README.md for visitor alerts.

Add a Django app

cd back
mkdir apps/billing && python manage.py startapp billing apps/billing
  1. In apps/billing/apps.py set name = "apps.billing"
  2. Add "apps.billing" to INSTALLED_APPS in config/settings.py
  3. Add path("api/", include("apps.billing.urls")) to config/urls.py

Most screens don't need one: build them as pages in the browser.

Model changed and something crashed?

rm db.sqlite3 && python manage.py makemigrations && python manage.py migrate

License

MIT

Releases

Packages

Contributors

Languages