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.
- 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
You can view a video demo of the login and register system here.
You can also view a live version of the demo here.
- Python 3.11+
- Clone the repository
git clone https://github.com/Catch-c/nsimon.git
cd nsimon- Install dependencies
pip install -r requirements.txt- Create a
.envfile in the root directory:
SECRET_KEY=your-flask-secret-key
DATABASE_FILE=database.db- Run the application
python app.pyThe application will be available at http://localhost:5000
This application provides several API endpoints available for you to use. All endpoints return JSON responses.
GET /api/uploads
Retrieves a list of uploads with optional filtering and pagination.
limit(int, default: 20): Maximum number of uploads to return. This is only used whensortis 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.
GET /api/uploads?limit=10&sort=random
{
"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
}GET /api/user
Retrieves user information.
If no id or username is set, it will default to the current authenticated user.
id(int, optional): User IDusername(str, optional): Username
GET /api/user?id=123
{
"id": 123,
"username": "0923",
"display": "sebcun",
"avatar": "path/to/avatar.png"
}GET /api/sets
Retrieves popular sets based on upload count.
limit(int, default: 10): Maximum number of sets to return
GET /api/sets?limit=5
{
"sets": [
{
"setid": "10251-1",
"upload_count": 15
}
]
}GET/POST /api/like/
Like or unlike an upload. Requires authentication.
POST /api/like/456
{
"liked": true,
"likes_count": 6
}GET/POST /api/favouriteset/
Favorite or unfavorite a set. Requires authentication.
POST /api/favouriteset/10251-1
{
"favourited": true,
"favourite_count": 1
}GET/POST /api/follow/
Follow or unfollow a user. Requires authentication.
POST /api/follow/789
{
"following": true,
"followers_count": 11
}Contributions are welcome! Please feel free to submit a Pull Request.
If you run into any issues or need support, please open an issue on the repository.
This project is licensed under the MIT License - see LICENSE for details.