harrynull / GalleryNeo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GalleryNeo

Your favorite good ol' Shopify Code Challenge now comes in Kotlin!

It implements the following features:

  1. User registration, login with passwords securely hashed with argon2id.
    1. comes with a session manager!
  2. Upload images, handled securely (I know how vulnerable it could have been when doing CTF competitions).
  3. Delete images, handled securely
  4. Image permissions (private vs. public images).
  5. Elegant, efficient and easy-to-maintain code .
  6. Comprehensive tests
  7. A quick and dirty frontend so you don't have to use command lines to test its functionality.
  8. All written in one day (and no I didn't pull an all nighter)!

What wasn't done because of time constraints (But I could have done it if needed):

  1. Cache with Redis.
  2. Admin permissions.
  3. Pagination
  4. Checking if the uploaded file has proper image header (so users don't abuse it as a cloud drive)
  5. Persisting uploaded file to remote locations (e.g. Amazon S3)
  6. A beautiful frontend.

Written with Kotlin, Springboot, MySQL, protobuf

Deployment/Development

You need to have an SQL database (tested with MySQL 8.0) installed and change the configuration in application.properties. Alternatively, change your environment variables MYSQL_HOST, MYSQL_USERNAME , MYSQL_PASSWORD, MYSQL_DB. The default values are localhost:3306/gallery and localhost:3306/gallery_test with username and password as root

Then, you can run it with ./gradlew bootRun and it will start a server at http://localhost:8080

You can also run the tests with ./gradlew test

If you somehow really wants to use it in production, it is recommended to put it behind nginx and use the compiled jar instead.

Frontend

To run the frontend, run cd frontend/ && npm install && npm run start (or yarn if you prefer so)

Make sure it's running on http://localhost:3000 or CORS won't be working.

Spoiler: the code for FE is hacky and dirty but, hey, it works.

License

This program is licensed under AGPLv3. That said, you are discouraged from using it for your own code challenge.

About

License:GNU Affero General Public License v3.0


Languages

Language:Kotlin 91.1%Language:JavaScript 7.3%Language:CSS 1.0%Language:HTML 0.6%