
Join me in this course as I build an MVP to solve apartment management challenges, including issue reporting, maintenance, and technician tracking, by replacing problematic WhatsApp processes.
Designed for experienced Python developers, this course teaches integrating React and Next.js with Django REST endpoints, covering Django basics, REST fundamentals, JavaScript and TypeScript, React components and hooks, and Docker.
Learn front-end tools like React, Next.js, TypeScript, Tailwind CSS, and RTK Query with Zod validation and hero icons, and back-end stack with Django REST framework and Docker.
Demonstrates a full-stack django with react MVP end-to-end, covering signup, authentication, posts, issue tracking, technicians, admin workflows, and notes on production deployment and testing.
Create a working directory and api folder, install Python and Pipenv to make a virtual environment, and install Django 4.2.0. Activate the env and review Pipfile and Pipfile.lock.
Initialize git for a Django project, create a Python .gitignore with npx, ignore dot envs but include env.example, start the Django project, and commit the initial setup.
Here are the packages that were installed in this lecture, if you don't want to type it out:
pipenv install python-dotenv==1.0.1 djangorestframework==3.15.0 django-autoslug==1.9.9 django-countries==7.5.1 django-phonenumber-field==7.3.0 phonenumbers==8.13.32 drf-yasg==1.21.7 Pillow==
10.2.0 argon2-cffi==23.1.0 djoser==2.2.2 django-taggit==5.0.1 django-filter==24.1 django-celery-email==3.0.0 cloudinary==1.39.1 django-celery-beat==2.6.0 redis==5.0.3 celery==5.3.6 flower==2.0.1
Organize dependencies with base, local, and production requirements and split Django settings into base, local, and production modules, loading environment variables with dotenv.
Configure Django parameters by updating settings, wsgi, and urls; generate a secret key, set env vars, and prep Redis, Postgres, Mail Pit, and Celery for development.
Organize a Django project by creating modular apps (users, common, profiles, posts, issues, ratings) in core_apps, set translatable verbose names, and register them in settings.
Discover how to implement Django logging with the Python logging module, using loggers, log levels, handlers, filters, and formatters to debug and route messages to console, files, or external services.
Define a development logger in settings local.py with a verbose formatter and console handler for debug output. Configure postgres in base.py via env vars and delete the sqlite db.
Configure django with docker using docker desktop, docker engine, docker compose, and the Portainer extension, then build multi-stage dockerfiles with python base images, wheels, and entrypoint scripts.
Learn to create an entrypoint shell script in a Django and Docker setup that waits for a Postgres database using psycopg2, with robust bash options, environment vars, and error handling.
Create a start script that migrates models, collects static files, and runs the Django server on 0.0.0.0:8000, while configuring dockerignore to exclude unnecessary files.
Set up Postgres with docker compose, define a local docker environment, create a Postgres dockerfile, configure docker networks and volumes, and define API and Mailpit services in a multi-service compose.
Configure docker compose with a local yaml, read environment variables from .env.local for api and postgres, fix indentation, build and run containers, and verify status via Docker Desktop and Portainer.
Learn how to streamline docker workflows with makefiles by defining tasks in a makefile, covering build, up, down, logs, migrations, static collection, and database inspection.
Learn to build a custom Django user model manager that authenticates with username and email, validates and normalizes emails, and supports creating normal and super users.
Learn how universal unique identifiers serve as globally unique primary keys, boosting security and scalability, while noting size, sorting tradeoffs and the option of a pseudo primary key.
Create a custom Django user model in the users app with a pseudo primary key via UUID, using a custom user manager and email as the unique identifier.
Create and customize a Django admin user form, including user creation and change forms, validation for duplicate email and username, and detailed fieldsets and add-form styling for the admin interface.
Set up redoc API documentation for a Django REST framework project, configure OpenAPI info and public access, and customize the admin site.
Initialize a Next.js frontend for a Django project using npx create next app (v14.1.4) with TypeScript, ESLint, Tailwind, and the app router; run the dev server and review app structure.
Configure the client Git setup by aligning the gitignore with the backend, exclude the lib folder, and prepare for the next lecture on the client Dockerfile.
Create a multi-stage client dockerfile with node 20 alpine, install dependencies via npm or yarn, copy source, set a non-root Next.js user, and run the dev server, plus a dockerignore.
Add a client docker compose service by configuring context, docker file, port 3000, and volumes for client and node_modules. Prepare for nginx reverse proxy to unify backend and frontend ports.
Understand nginx as a reverse proxy and load balancer that routes requests to app servers on a single port with https, enabling horizontal and vertical scaling via round-robin.
Configure nginx as a reverse proxy for api and client services, define upstreams, handle websocket upgrades, route key paths, serve static files with caching, and prepare dockerized nginx setup.
Configure Nginx as a docker-compose service, using expose to share ports and proxy the Django API and Next.js client on 80 and 8080.
Learn how to use celery, an asynchronous task queue, with django to run background tasks like sending emails. Leverage Redis as the broker and backend, and monitor with Flower.
Configure celery in a Django project by creating a celery app, connecting to Redis as broker and result backend, auto-discovering tasks, and enabling celery beat for scheduling.
Summarizes a docker-compose setup for celery and redis in Django, reusing API config via anchors and defining celery worker, celery bit, and flower with start scripts on port 5555.
Create and configure celery beat, celery worker, and celery flower start scripts in a Django project, using watch files for development and guidance against production deployment with systemd or supervisor.
Explore building a timestamped abstract model and a reusable content view model in Django, using a generic foreign key, content types, and user tracking, then register the admin interface.
Explore configuring a Django profile model with a Cloudinary avatar, set up Cloudinary credentials in env, link a 1 to 1 profile to user, and include slug generation and occupation.
Implement a Django post-save signal to auto-create a user profile on new user creation, using signals.py, a receiver decorator, and logging, with admin registration and migrations.
Differentiate authentication from authorization and explain how access and refresh tokens enable secure API calls. Explore JWT bearer tokens, short lifespans, and refresh token rotation with reuse detection.
Implement token-based authentication with the Jozsa package, returning access and refresh tokens as http-only cookies and using a custom Django Rest Framework authentication class.
Configure Djoser and rest framework JWT-based authentication with a custom user serializer and environment-based signing keys. Enable pagination, throttling, Google social auth, and JSON settings for the REST framework.
Build custom cookie authentication in Django REST framework with login, refresh, and logout views that set HttpOnly access and refresh cookies, plus Google social login and cookie-based session status.
Create users/urls.py with provider, login, refresh, and logout endpoints, then include them in the project's api/v1/auth path, and use Postman to test activation, cookies, and token refresh.
Register a Google project and configure the OAuth consent screen. Create a web OAuth client with redirect to localhost:8080/api/v1/auth/google, then update env vars and Django social backends to test login.
I previously lived in a large apartment complex with over 500 apartment units, all owned by a single landlord.
The complex was plagued by inefficient service delivery, issue reporting, and maintenance operations.
Tenants were expected to report problems via a shared WhatsApp account, which often resulted in messages going unread, being read too late, or being forgotten due to the high volume of incoming messages.
The landlord’s technicians(who included plumbers,carpenters, masons, electricians, roofers et-cetera) who were responsible for addressing various issues, frequently ignored calls for assistance or provided false excuses about their availability. Tracking the technicians' whereabouts and providing feedback to the landlord on their work was a challenging task.
To make matters worse, some tenants used the same WhatsApp account to advertise their goods that they were selling(such as food, clothes et-cetera), causing further confusion and hindering the issue reporting process.
Reporting misbehaving neighbors who violated the tenancy agreement and were a nuisance to other neighbors, also proved to be difficult.
I finally had enough and moved out of that place… which kept me wondering…if I was fortunate enough to somehow get money in the future and was able to build my own set of apartments, just like my former landlord did, what would I do differently?
Welcome…. Join me in this course as I build an MVP(which is a minimum viable product), to solve some of the problems I encountered while I was living in the apartment complex. This solution being an MVP, of course it can be improved or customized to solve your needs.
I hope this course will provide valuable insights and solutions to those facing similar challenges in apartment management..