Summary Files Commits Branches @commit @diff @stats
path: root / README.md
blob: 7003325f26899584ab90ae2dba3fea09c4e7ba70 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# devrix-job-board

The repository for my solution of DevriX's exam for their internship program.

It's an oversimplified job offer website, (roughly) following the MVC design pattern and using the LAMP stack (with MySQL). In `src` you can find the source code and in `db-export` you can find the export of a very small demo database.

**CREDENTIALS FOR DASHBOARD**
```
Username: admin
Password: admin
```

<details>
	<summary>Screenshorts of site</summary>
	<img src="./screenshots/landing-page.png">
	<img src="./screenshots/create-offer.png">
	<img src="./screenshots/dashboard-login.png">
	<img src="./screenshots/dashboard-logged-in.png">
	<img src="./screenshots/edit-offer.png">
</details>

## Contents
- [Getting started](#Getting%20started)
- [Structure](#Structure)
  - [Back-end](#Back-end)
  - [Front-end](#Front-end)
- [Tools](#Tools)
- [Issues and Future](#Issues%20and%20Future)

## Getting started

1. As previously mentioned, the project uses the LAMP stack. Links on setting it up: [Ubuntu 20.04](https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-20-04), [Debian 8](https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-debian-8) or [CentOS 8](https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mariadb-php-lamp-stack-on-centos-8).

2. You'll need to update the source code with your `MySQL` credentials. In the file `src/models/DB.php`, on lines 6 to 9 you'll find the connection information. You'll need to change the values of `$username` and `$password` with your own.
   - If you're connecting to a remote database or have your database at a non-standart port, you'll also need to change `$servername`. Changing the value of `$dbname` is completely up to preference.
   - Don't worry if the database or tables don't exist, when the app starts it automatically create them.

3. Currently this repo provides an Apache configuration file (`configs/devrix-job-board.conf`) with the localhost domain `djb.local`.
   - To use that domain, you'll also need to open your `/etc/hosts` file and add, on a new line, `127.0.0.1	djb.local`. **Beware**, it will break any other localhost domains you've setup.
   - If you wanna use it in a server environment, update the values of `ServerName` and `ServerAlias` with your desired domain and subdomain.

4. Finally, we'll need to move the source code to the `/var/www/devrix-job-board/` folder.
   - This (and creating the folder if it doesn't exist) can be done automatically, just run with sudo the `move-to-www.sh` script:
     ```
     sudo ./tools/move-to-www.sh
     ```

## Structure

This section serves as a mini-documentation of the overall project.

### Back-end

For the back-end, it uses pure PHP, without any libraries what so ever. Database access is done with automatically generated queries (see [`DB.php`](https://github.com/Syndamia/devrix-job-board/blob/main/src/models/DB.php)) and URI routing is done, using the `$_SERVER`'s request URI (see [index.php, Line 44](https://github.com/Syndamia/devrix-job-board/blob/67bc860ea4b3db5033a42038ab86d0df955c9295/src/index.php#L44)).

The database has two tables: `companies` and `job_offers`. Inside `companies` is stored the different company name. `job_offers` contains the actual job offers, where the company is referenced with a foreign key to the `comapnies` table.

### Front-end

The front-end is a modified version of the given [template](https://github.com/xavortm/html-template-jobs). I took the CSS and the structure of the HTML files and applied it to my structure, trying to leave behind as little as possible.

There are also a few custom stylings I had to make, all located in [`prog.css`](https://github.com/Syndamia/devrix-job-board/blob/main/src/css/prog.css). These are mainly:
- a navigation bar
- form and input styling
- pages that have only a form inside them (for example, the [`create offer`](https://github.com/Syndamia/devrix-job-board/blob/main/src/views/create-offer.php) page)

## Tools

This repo contains some tools that could be useful during setup and development of the app. They're all located in the `tools` folder.

1. `move-to-www.sh` - moves the source code (located in `src`) to the `/var/www/devrix-job-board/` folder
2. `watch-move-to-www.sh` - does the same thing as `move-to-www.sh`, but does it automatically every time you update a file inside the `src` folder. Especially useful while developing the application.
   - Dependencies: [`inotify-tools`](https://pkgs.org/download/inotify-tools)

## Issues and Future

The project has the following issues, that the original task description didn't explicitly require to be fixed, but might be a good idea to explore:
- There is no "404 Not-found" page
- There is no system for user accounts (and by extension, no system for accepting/signing up to job offers)
- There is no job offer page (a page for viewing a job offer; currently it only makes sense for sharing, as the landing page shows all job offer information)
- There is no way to practical way to change the Dashboard page credentials or add multiple ones (e.g. they're hard coded)

These are the following things that might be a good idea to explore, post exam evaluation:
- Actually using proper tools for the job (using an ORM for database queries, using a more fleshed out routing plugin, etc.)
- Adding search functionalities (by words and by tags, like company, date, salary, etc.)
- Either adding more info to job offers or updating the styling to better fit the current job offers
- Have a proper way to add and remove companies