Thanks to visit codestin.com
Credit goes to github.com

Skip to content

sebcun/myLegoDB

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

myLegoDB

License: MIT as

myLegoDB is a website built with Flask that allows users to share LEGO sets they have built. Users can register for accounts, upload images of their LEGO sets, browse other users' collections, like uploads, favourite sets, and follow other users.

This project was created for the Hackclub YSWS, Authly. A challenge where the goal was to create a unique and fun authentication system. For me, this was to create a LEGO minifigure builder for users, and a "Build Your Password" where you place bricks of different sizes and colours on a grid for your password.

Features

  • User registration and authentication
    • "Create Your Username" - A LEGO minifigure builder for usernames.
    • "Build Your Password" - A grid where you place bricks of different sizes and colours for passwords.
  • Upload and display LEGO set images
  • Browse and search LEGO sets
  • User profiles with follower/following functionality
  • Like and favourite features for sets and uploads

Demo

You can view a video demo of the login and register system here.

You can also view a live version of the demo here.

Stack

Backend

Flask Python SQLite

Frontend

HTML5 Jinja JavaScript CSS3 Bootstrap

Setup

Requirements

  • Python 3.11+

Setup

  1. Clone the repository
git clone https://github.com/Catch-c/nsimon.git
cd nsimon
  1. Install dependencies
pip install -r requirements.txt
  1. Create a .env file in the root directory:
SECRET_KEY=your-flask-secret-key
DATABASE_FILE=database.db
  1. Run the application
python app.py

The application will be available at http://localhost:5000

API Endpoints

This application provides several API endpoints available for you to use. All endpoints return JSON responses.

Retrieves a list of uploads with optional filtering and pagination.

Query Parameters

  • limit (int, default: 20): Maximum number of uploads to return. This is only used when sort is set to 'random'.
  • sort (str, default: 'newest'): Sort order - 'newest', 'oldest', or 'random'.
  • page (int, default: 1): Page number for pagination.
  • per_page (int, default: 20): Number of uploads per page.
  • author (int, optional): Filter by user ID.
  • set (str, optional): Filter by set ID.
  • following (bool, default: false): If true, only show uploads from the authenticated users user follows.

Example Usage

GET /api/uploads?limit=10&sort=random

Response

{
  "uploads": [
    {
      "id": 1,
      "author": "username",
      "setid": "10251-1",
      "image": "path/to/image.jpg",
      "created_at": "2025-08-30T12:00:00",
      "likes": 5,
      "liked": true
    }
  ],
  "total": 20,
  "page": 1,
  "per_page": 20
}

Retrieves user information.

Query Parameters

If no id or username is set, it will default to the current authenticated user.

  • id (int, optional): User ID
  • username (str, optional): Username

Example Usage

GET /api/user?id=123

Response

{
  "id": 123,
  "username": "0923",
  "display": "sebcun",
  "avatar": "path/to/avatar.png"
}

Retrieves popular sets based on upload count.

Query Parameters

  • limit (int, default: 10): Maximum number of sets to return

Example Usage

GET /api/sets?limit=5

Response

{
  "sets": [
    {
      "setid": "10251-1",
      "upload_count": 15
    }
  ]
}

GET/POST /api/like/

Like or unlike an upload. Requires authentication.

Example Usage

POST /api/like/456

Response

{
  "liked": true,
  "likes_count": 6
}

Favorite or unfavorite a set. Requires authentication.

Example Usage

POST /api/favouriteset/10251-1

Response

{
  "favourited": true,
  "favourite_count": 1
}

GET/POST /api/follow/

Follow or unfollow a user. Requires authentication.

Example Usage

POST /api/follow/789

Response

{
  "following": true,
  "followers_count": 11
}

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Issues

If you run into any issues or need support, please open an issue on the repository.

License

This project is licensed under the MIT License - see LICENSE for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published