The goal of this assignment is to implement all the client-side functionality. An example implementation is in the image below.
Please note that the styles are not provided for this assignment, and your application can look different. But the nicer and more usable it is, the better the mark.
Please watch the presentation to understand about the roles you will play. As explained, you will work on two repos. In one repository you will develop your code, in another one, you will review and approve pull requests from another developer. Therefore the process is following:
First, make sure that "pnpm" and "turbo" is installed in your computer. If not, please follow installation instructions for pnpm. If turbo is not installed, please install it using pnpm with the following command:
Then, run the following command to install turborepo.
pnpm add -g turbo
Once the pnpm is installed, in the root of the project install the packages
pnpm i
To run end to end tests you need to install headless browsers. Please run the following command in the tests/playwright-web
directory
pnpx playwright install
In the apps/admin
and packages/db
project, duplicate the .env.example
file and rename the duplicate to .env
. In the .env
file set the correct values, for example in the apps/admin
these woulde be the values that you set:
PASSWORD=123
JWT_SECRET=super-secret-password
In the packages/db
you need to set path to your SQLite database:
DATABASE_URL="file:./dev.db"
Please remember to modify both projects! If you fail to set the variables, the next step will result in errors.
To run the project, run the following command in the root directory of your project:
turbo dev
This will run:
To run the tests please run, you have two options.
If you only wish to visualise the test results in console, please run the following command in the root of your project:
turbo test-1
This launches the turbo console UI similar to below, where you can swap between different projects:
⚠️ Make sure that ALL tests pass!
If you want to run the tests for second part (i.e. Assignment 2.2) or third part (i.e. Assignment 2.3), run these commands:
turbo test-2 // or
turbo test-3
If you want to run all tests, please run
turbo all:test
The packaged tests framework also have the possibility of visually represent your tests for nicer view of test results. To see the UIs, run this command instead of turbo test-1
turbo dev:test-1
This will launch the End to End testing framework Playwright's test UI similar to below, please use the Play buttons to run individual tests:
It also launches the unit and integration test framework Vitest's UI, similar to below. Here, you can also use the play buttons to execute individual tests!
The project is monorepo with the following packages split into three categories:
Applications
Contains the following web applications:
Packages
Contains the following packages with shared code and configurations:
Tests
Contains the following test applications:
The client application comes with pre-defined router (only one route is missing for your learning). The client application also comes with pre defined structure of components and utilities for you to complete. The admin application is much more bare with most functionality AND structure needed to be completed by you.
If you use the Visual Studio Code for your development, we stringly recommend installing the following packages:
If you install these plugins, you can find all your tests in the Test Explorer (see image below), allowing you to execute and debug your tests.
Good Luck!
It's time for your second, more comprehensive assignment. This time, we will create a blogging platform!
In this second assignment, you will develop a Blogging platform. The goal of the first part of this assignment is to complete the client-side functionality of a blog application. You will work with predefined structures and enhance the existing functionality.
To succeed, you must ensure all tests pass and be able to explain every piece of code you write. You will explain your code to your tutor, during tutorial classes.
Let us talk about the required functionality for clients to access your blogging platform.
Users should be able to filter posts by category.
Users should see an archive of posts sorted by month and year.
Similarly, users should be able to filter posts based on tags.
Users should be able to search for posts using keywords found in the title or description. As the user types, the list of blog posts should dynamically update based on the search query.
Users should be able to switch to dark mode.
In the list view, a user should the the title of the blog post, a short description, date the post was created, the image tags, number of likes and views.
The post detail page shows the same information and the list view ...
... plus, it shows the formatted text of the post, considering that the posts are written in the Markdown format.
Let's discuss how you can set up this project on your computer.
This assignment is a group project, with the following roles:
Programmer is responsible for the implementation of the code and the delivery of the solution.
The product owner is responsible for ensuring the quality of the final solution. Consequently, each contribution is in the form of pull requests, with the product owner approving pull requests. The twist is, that you will play BOTH roles.
Consider this example, with three students, Bill, Jane and John.
Each student is responsible for programming the final solution in their own repository ....
But, Bill not only codes, he also is approving all pull requests from Jane in Janes repository B.
Jane, codes in repository B, but approves pull requests in John's repository C.
And John codes in repository C but approves Bill's pull requests in repository A. As you see, everyone is playing both roles.
Use one of the following links and create a new group in which you will host your project and the reviewer. Please use your name as the name of your group.
If one link tells you that the maximum number of groups was reached, use the other one.
Accept the assignment and clone it to your compute
Remember which link you have used to create your group, either A or B.
Once you create your group and accept the invitation, go to the other group link and join one of the projects. Meaning, if you created your project group in A, join projects in group B It is possible that yet there will be no projects, try at a later date.
It is important to note that you cannot join your reviewer's project. Meaning that if for example Jane joined my project as reviewer, I cannot join Janes project to become her reviewer. While the system will permit that, we will check for these conflicts and reassign you.
Let's explore the project structure after you clone it to your hardrive. It is a slightly more complex structure as you are dealing with monorepo.
In the apps directory you will find two nextJS web applications containing separate UI the client blog view and admin dashboards.
In the packages directory, you will find several packages containing database configuration and access, configuration of environment variables, shared utilities and configurations for development tools such as typescript, eslint or tailwind.
In the tests directory, you can find tools like Playwright for end-to-end tests for both client and admin and Storybook for presentation and development of components in isolation.
The client application comes with a predefined routing system, except for one missing route you need to implement.
The project includes an existing component structure that you will need to complete.
The admin application is more barebones, requiring you to implement most of its functionality.
To run the project, make sure both pnpm and turbo are globally installed.
If not, install them with npm
Before you run the project, you need to set up the environment variables. In the apps/admin project and packages/db project, duplicate the "env example" file and rename it to ".env". Then, configure the values to your liking, mainly setting the strong secret and password.
To run the project, run the turbo dev command in the root directory of your project. The client will be available on port 3001 on localhost, while admin will run on port 3002.
This assignment has three parts and you can always run related tests for that part using turbo-1, turbo-2 or turbo-3 commands.
We have also configured test runners with visual UIs and you can run them with turbo dev:test-1 and similar.
If you run the tests using the "turbo test" command, your tests will run in the console. This is a handy way of visualising your tests. However, with many errors, this view can become cluttered and confusing.
In you run the turbo dev:test command, the tests are executed in visual mode, launching several visual interfaces facilitating the view of test result in integration tests ....
as well as end-to-end tests.
Use the handy play buttons to execute only the tests you require.
Moreover, if you install the playwright and vitest extensions to Visual Studio Code, you can execute the tests directly from your code.
So, how to start?
Begin by implementing the blog list and detail pages. You might want to look in the packages/utils package first and implement the required functions.
Make sure search, category, tag, and date-based filtering functions as expected.
Finally, verify that all tests pass before submitting your assignment.