This repository contains a base project for internship program at EBS Integrator, each candidate for position of Junior Backend Developer must be able to develop all the tasks in the following lists. Fork it and bring it to the next level.
- Before starting this program you should know Python or another programming language at a level beginner, and understand syntax, variables, functions, algorithms, etc. If you have lacked in language understanding then start with https://www.learnpython.org/
- First milestone is to prove that you are ready for internship program
- Before each milestone estimate each task in hours of work to understand how much time you need to achieve the finish, don't worry if your estimations are wrong because you don't have experience.
- After each milestone or sequence of tasks create a merge request to your mentor to receive feedback, after code review you will have something to fix this will improve your coding skills
- Stay focused on tasks and ask questions if you don't understand something and can't find it on Google (googling is a basic skill for developers).
- https://www.djangoproject.com/ - official documentation of Django framework
- https://www.django-rest-framework.org/ - documentation of DRF, an package for Django to transform it in a full REST API framework
- https://restfulapi.net/ - documentation about REST APIs communication standard
- https://github.com/ebs-integrator/rest-api-guide - A short REST API guide used in the company
- https://swagger.io/docs/specification/2-0/what-is-swagger/
- https://github.com/HackSoftware/Django-Styleguide - A styleguide for Django developers
- https://www.django-antipatterns.com/ - A resource with most frequent mistakes in Django development
Some steps before start work on tasks.
https://docs.djangoproject.com/en/4.2/intro/install/
- Install poetry
pip install poetry
- Install python requirements
poetry install
- Install pre-commit hooks
pre-commit install
- Database is SQLite, local, and execute
python manage.py migrate
- Start the project
python manage.py runserver
- Open website and register a user in /users/register endpoint
- Login with registered credentials in /users/token endpoint
- In swagger click "Authorize" button and type
Bearer <access token from response>
- Let's do first milestone!
We start with some changes to understand the project code
- How to add new fields in Django Models
- How to add new Django Models entities
- How to create a new API endpoint that add data in database
- How to manage information in Django Admin
- Add in Blog model a boolean field
enabled
to make some posts published or unpublished ( ref: https://docs.djangoproject.com/en/4.2/ref/models/fields/#booleanfield) - Open in Django Admin (access /admin website section) and add in Blog list the real blog name and status ( enabled/disabled): Preview ( ref: https://docs.djangoproject.com/en/4.2/ref/contrib/admin/)
- Make an endpoint for create a blog post (similar as register endpoint) that will add a new record in blog table ( ref: https://www.django-rest-framework.org/api-guide/generic-views/#genericapiview)
- Create a new model
Comments
withtext
andblog
foreign key, here we will save comments for each blog post. - Add Comments for management in Django Admin ( ref: https://docs.djangoproject.com/en/4.2/ref/contrib/admin/#modeladmin-objects)
- Create an endpoint that creates a comment to a blog post (input: blog_id, text)
- In endpoint
/blog/{id}
return the Blog post object and list of comments.
Based on previous experience, create a new project with a simple Task Management system. You need to set up DB, DRF and Swagger to build a beautiful API.
- How to create new projects
- How to design a database
- How to create a full API
- How to send email notifications
These screens will help you to imagine the app:
-
Create a new django project with the same file structure like previous project ( ref: https://docs.djangoproject.com/en/4.2/intro/tutorial01/)
-
Install poetry and pre-commit hook as in previous project
-
Copy "common" and "users" apps from previous project and start the project
-
Create Register endpoint - user send first name, last name, email, password and receive JWT access token and refresh token for authentication.
Example:
{ "access": "eyJ...", "refresh": "eyJ..." }
-
Create Login endpoint - user send email, password and receive JWT access token and refresh token for authentication.
Example:
{ "access": "eyJ...", "refresh": "eyJ..." }
-
Get list of users endpoint - user receive a list with id and full name of all users from application
-
Create a new "tasks" app that will have Task model with title, description and status fields(Choices: Open, In Progress, Completed, Canceled, Archived)
-
Create a task endpoint - user send title, description and receive new task data, the new task is assigned to current user
-
View list of tasks - user receive a list with id and title of all created tasks from application
-
View task details by id - user send task_id and receive task details: id, title, description, status, owner
-
Add filter by user_id in get list of tasks endpoint to receive tasks assigned to specific user
-
Add status filter in get list of tasks endpoint to receive tasks with specific status
-
Assign a task to user - user send task_id and user_id and receive successful response after update task owner
-
Complete a task - user send task_id and receive successful response after update of task status in completed
-
Remove task - user send task_id and receive successful response after task deletion
-
Create a new "Comment" model in "tasks" app
-
Add comment to task - user send task_id, comment text and receive id of the new comment
-
View task comments - user send task id and receive list of all comments added to this task
-
Add email notification when task is assigned to me
-
Add email notification when my task is commented
-
Add email notification when commented task is completed
-
Search task by title - user send search term and receive list of tasks that match
Add these new functions to your task application to help users to track time spent on completion of each task. User will start time when start working on task and stop it when complete the task or take a pause.
- How to work with relational entities
- How to create complex database queries (https://docs.djangoproject.com/en/4.2/topics/db/queries/)
- Start a timer for my task - user send task id and receive successful response after logging the start of task in DB
- Stop timer for the started task - user send task id and receive successful response after adding a time log for this task with duration of work for current date
- Add time log for a task on a specific date - user manually send in task id, date, duration in minutes and receive successful response of save
- Get a list of time logs records by task - user send task id and receive list of all time logs created for this task
- Change get list of tasks endpoint get receive the sum of the time in minutes for each task
- Get the logged time in last month - user send a request and receive total amount of time logged by him in last month
- Get top 20 tasks in last month by time - user send request and receive list of id, title, time amount of tasks with bigger logged amount of time
In this milestone we start to improve our application.
- How to work increase quality of you app and identify bugs
- How to install and switch project to PostgreSQL database and use pgHero
- How to find out performance issues and improve response time of your endpoints with cache
- How to work with Docker
- Add unit tests for each endpoint https://www.django-rest-framework.org/api-guide/testing/
- Add coverage package and generate report to be sure in 100% test coverage https://docs.djangoproject.com/en/4.2/topics/testing/advanced/#integration-with-coverage-py
- Install PostgreSQL docker container and move your app on PostgreSQL (edit settings.py)
- Create a script that will add random 25.000 tasks and 50.000 time logs ( use https://docs.djangoproject.com/en/4.2/howto/custom-management-commands/)
- Install PGHero docker container and connect it to your db https://github.com/ankane/pghero/blob/master/guides/Docker.md
- Manual test all endpoints and check with PGHero that all sql queries use db indexes, after insert of thousands of tasks some endpoints can perform slow
- Install Redis docker container and configure Django to cache with 1 minute TTL the endpoint with Top 20 tasks by time for each user https://github.com/jazzband/django-redis
- Create Dockerfile for your application to run it with docker-compose command
In this milestone we will improve the application with new features and third-party services.
- How to work with MinIO (S3 compatible storage)
- How to work with celery and redis
- How to work with django signals
- How to use django templates
- How to work with elastic search
- How to integrate third-party authentication
- How to setup github actions for CI/CD
- Use MinIO as static and media storage for your application https://pypi.org/project/django-minio-backend/
- Create a new model "Attachment" with file field and task foreign key (use MinIO for storage)
- Add attachment to task - user send task_id and file and receive successful response after adding attachment to task
- Get list of attachments by task - user send task_id and receive list of all attachments added to this task
- Send all email notifications with celery https://docs.celeryproject.org/en/stable/django/first-steps-with-django.html
- Create celery beat task that will create a report with top 20 tasks by time for each user using Django templates and send it by email to each user one time per week
- Create a signal handler that will create a new task in elastic search when task or comment is created or updated https://elasticsearch-dsl.readthedocs.io/en/latest/
- Create endpoint that will search by choosing task field or comment in elastic search
- Add third-party authentication with GitHub https://django-allauth.readthedocs.io/en/latest/
- Add all this to your docker-compose file and test it
- Create a github action that will run ruff lint and tests on each pull request https://github.com/features/actions
Congratulations on your job well done. We appreciate your dedication, and we look forward to seeing your career flourish.
- Think and design your own project, what startup would you like to build? Do it now!
- With your mentor plan some tasks from real running projects