# nuxt-prawo-jazdy

<img src="https://netman.ovh/thumb/prawo_jazdy1.png" height=150>
<img src="https://netman.ovh/thumb/prawo_jazdy2.png" height=150>
<img src="https://netman.ovh/thumb/prawo_jazdy3.png" height=150>

Polish driver's license theoritical exam nuxt web app

### <i>What's it do?</i>

It mimicks the official Polish driver's license theoritical exam - has all categories from the database of questions from the Polish Ministry of Infrastructure (AM, A1, A2, A, B1, B, C1, C, D1, D, T, PT), which includes languages Polish, English, German and Ukrainian (not all questions provided by the Ministry are available in Ukrainian, so when using the Ukrainian version, you don't get such questions on the exam mimick).

You can choose above options (category and language) and you're greeted with a replica of an official exam (20 basic questions, 12 advanced questions). Time for each basic question includes 20 seconds to get acquainted with the question, time for media to load, and 15 seconds for an answer. Time for each basic question includes 50 seconds for an answer.

### My intent, inspiration and information about the project

My intention is, to share access to test exams free of charge, you don't have to pay me - although you can, I greatly appreciate if you donate!

I'm planning to host this project publicly and to put non-invasive ads if it gains enough traction

All data used by this software is public information by definition provided in the Polish Constitution - [article 61.](https://www.sejm.gov.pl/prawo/konst/polski/kon1.htm), and can be acquired by either checking above links on the gov website, or by writing to the Ministry [(if something happened to be missing)](placeholder_for_post_about_missing_points_column) ==> (blog post to write in the future)

This project is a website mimicking an official driver's license theoritical exam with a seperate media http server (not included here), connected using drizzle ORM to a SQLite database

## Running

### Required

#### db

A python script at [db-prawo-jazdy](https://git.mandarynki.eu/netman/db-prawo-jazdy) is designed to convert the CSV(s) to a SQLite database for use here. When you acquire your database via that script, insert it at your desired path (default `./db/database.db`) and change the `DATABASE_URL` environment value in `.env`. Visit [db-prawo-jazdy](https://git.mandarynki.eu/netman/db-prawo-jazdy) for more details.

The database from November 2025 is included here at `./db/database.db`

#### media

A shell script at [media-prawo-jazdy](https://git.mandarynki.eu/netman/media-prawo-jazdy) for media files ([available on the website of the Ministry of Infrastructure](https://www.gov.pl/web/infrastruktura/prawo-jazdy) under the link title `Pytania egzaminacyjne na prawo jazdy`) will convert (copy) all `.wmv` files to `.mp4` and copy all `.jpeg` files to `.jpg`. When you have all media and the script completed successfully, host these files on a webserver of your choice (e.g. apache, nginx), and change the `CDN_URL` environment value in `.env` to your webserver URL including the folder path to the media files. Visit [media-prawo-jazdy](https://git.mandarynki.eu/netman/media-prawo-jazdy) for more details.

## To-do:

- [x] re-forge database structure (good for now)
- [x] come up with how to show results appropriately
- [x] better answer click recognition
- [x] beautify website (good for now)
- [x] <b>Fixed?</b> Needs more testing, but should be fine. (question-mark?) - middleware between pages; finishing exam sometimes redirects to homepage instead of results, major issue
- [x] question timers
- [x] exam (& results?) warning leave message on exit and timer end (and definitely on refresh)
- [x] add keybinds:
  - S - start, D - next question, X - exam end, T/Y - yes, N - no, A - A, B - B, C - C
- [ ] i18n - pl, en, de, ua (<del>not all questions are available in ua, api handle</del> - already handled with sql)
  - [ ] UI i18n
    - [x] pl
    - [x] en
    - [x] de
    - [ ] <b>ua</b>
  - [x] db: examstore add language field, api handle languages (questions lang)
- [x] nuxt3 -> nuxt4 (hopefully working fine, seems to do so; so far)
- [ ] clean up js code in exam.vue and result.vue (currently a little bit of a mess)
- [ ] daisyui is stuck on 5.2.5 - newer versions break UI, reason unknown - consider moving to nuxtUI and another tailwind integration with nuxt than nuxtjs/tailwind

## Setup

Copy `.env.example` to `.env` and modify it to values specified in the `Required#db` and `Required#media` sections according to your case.

This project utilizes `pnpm`, thus it is recommended

```bash
pnpm install
```

### Development Server

Start the development server on `http://localhost:3000`:

```bash
pnpm run dev
```

### Production

Build the application for production:

```bash
pnpm build
```

Locally preview production build:

```bash
pnpm preview
```

Check out the [Nuxt documentation](https://nuxt.com/docs) for more information.

## [Licensing](./LICENSE) (AGPL-3.0-only)

```
nuxt-prawo-jazdy: Polish driver's license theoritical exam nuxt web app

Copyright (C) 2025 NetMan

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, AGPL-3.0-only.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
```

This is important:
 - Keep all existing copyright headers, [give credit](./NOTICE)
 - Any modified versions or works based on this project must also be AGPLv3
 - Users interacting with this project over a network must have full access to the source code (including of forks, or modified versions)