A terminal-based social networking platform written in Python. Connect, share, and interact with users through a command-line interface.
This project was inspired by Twitter (X) and Mastodon
This project mainly served as a learning experience for SQL-based databases (this was my main goal, yeah)
- Features
- Commands Reference
- Requirements
- Installation
- Directory Tree
- Configuration
- Getting Started
- Database Support
- XP and Achievements System
- Admin Commands
- Settings and Aliases
- AI Usage
- License
- Posts & Content: Create text posts, image posts (converted to ASCII art), poll posts, and quote other posts.
- Interactions: Like, comment, repost, pin and bookmark posts
- Social Features: Follow/unfollow users, view profiles, and explore their profiles.
- Direct Messages: Send and receive DMs with other users.
- Notifications: Get notified about interactions and mentions.
- Hashtags & Mentions: Use hashtags and mention other users in posts.
- Search: Search for posts, users, hashtags and mentions.
- ASCII Art Conversion: Convert images to ASCII art for terminal display (posts and avatars).
- Big Texts: Create large text posts using ASCII art.
- Polls: Create and participate in polls posts.
- Pinned and Bookmarked Posts: Pin important posts to your profile and bookmark posts.
- Private Accounts: Set your account to private mode.
- User Profiles: customize your profile with display name, avatar, bio, status, location and website (+ pinned posts).
- XP and Levels: Earn XP for interactions and level up to reach the top of the leaderboard.
- Admin Features: Moderate content and manage users with admin privileges (account).
| Command | Description | Usage |
|---|---|---|
| register | Create a new account | register <username> |
| login | Login to your account | login <username> |
| logout | Logout from your account | logout |
| whoami | Show currently logged in user | whoami |
| deleteaccount | Delete your account permanently | deleteaccount |
| changepassword | Change your password | changepassword |
| Command | Description | Usage |
|---|---|---|
| home | View home feed | home |
| feed | View feed from followed users | feed [page] |
| explore | View global feed | explore [page] |
| search | Search posts | search <query> [page] |
| usersearch | Search users | usersearch <query> [page] |
| hashtag | View posts with hashtag | hashtag <hashtag> [page] |
| htrending | View trending hashtags | htrending |
| hsearch | Search hashtags | hsearch <query> [page] |
| mentions | View user mentions | mentions <username> [page] |
| Command | Description | Usage |
|---|---|---|
| post | Create a text post | post <content> |
| postimg | Create post with local image | postimg <path> [caption] |
| posturl | Create post with image from URL | posturl <url> [caption] |
| postbig | Create post with large ASCII text | postbig <text> [content] |
| postpoll | Create a poll | postpoll <question> | <?> | <opt1> | <opt2>... |
| viewpost | View a specific post | viewpost <post_id> |
| deletepost | Delete your post | deletepost <post_id> |
| myposts | View all your posts | myposts |
| Command | Description | Usage |
|---|---|---|
| like | Like a post (+2 XP) | like <post_id> |
| unlike | Remove your like | unlike <post_id> |
| likes | View who liked a post | likes <post_id> |
| comment | Comment on a post (+5 XP) | comment <post_id> <comment_text> |
| delcomment | Delete your comment | delcomment <comment_id> |
| comments | View post comments | comments <post_id> |
| repost | Repost to your timeline (+5 XP) | repost <post_id> |
| unrepost | Remove your repost | unrepost <post_id> |
| quote | Quote a post with commentary | quote <post_id> <comment> |
| reposts | View who reposted | reposts <post_id> |
| Command | Description | Usage |
|---|---|---|
| follow | Follow a user (+5 XP) | follow <username> |
| unfollow | Unfollow a user | unfollow <username> |
| followers | View followers | followers [username] |
| following | View who you follow | following [username] |
| profile | View user profile | profile [username] |
| dm | Send direct message | dm <username> <message> |
| inbox | View your inbox | inbox |
| messages | View conversation | messages <username> |
| closedm | Close conversation | closedm <username> |
| Command | Description | Usage |
|---|---|---|
| displayname | Set display name | displayname <new_display_name> |
| bio | Set biography | bio <new_bio> |
| status | Set status message | status <new_status> |
| location | Set location | location <new_location> |
| website | Set website URL | website <new_website> |
| avatar | Set avatar from local image | avatar <image_path> |
| avatarurl | Set avatar from URL | avatarurl <image_url> |
| removeavatar | Remove your avatar | removeavatar |
| private | Toggle private account | private |
| Command | Description | Usage |
|---|---|---|
| votepoll | Vote in a poll | votepoll <poll_id> <option_num> |
| mypolls | View your polls | mypolls [page] |
| Command | Description | Usage |
|---|---|---|
| pin | Pin a post to profile | pin <post_id> |
| unpin | Unpin a post | unpin <post_id> |
| pinned | View pinned posts | pinned [username] |
| bookmark | Save post for later | bookmark <post_id> |
| unbookmark | Remove bookmark | unbookmark <post_id> |
| bookmarks | View your bookmarks | bookmarks |
| Command | Description | Usage |
|---|---|---|
| xp | View your XP and level | xp |
| achievements | View all achievements | achievements |
| leaderboard | View top players | leaderboard [limit] |
| Command | Description | Usage |
|---|---|---|
| report | Report a post | report <post/comment/user> <id/user> <reason> |
| Command | Description | Usage |
|---|---|---|
| notifications | View notifications | notifications |
| clearn | Clear notifications | clearn |
| settings | View current settings | settings |
| setting | Change a setting | setting <setting_name> <new_value> |
| Command | Description | Usage |
|---|---|---|
| help | Show help message | help |
| exit / quit | Exit application | exit / quit |
| clear | Clear console | clear |
| alias | Create command alias | alias [alias] [command] |
| unalias | Remove alias | unalias <alias> |
| bigtext | Preview ASCII text | bigtext <big_content> |
- Python: 3.7 or higher
- Dependencies: Install via
requirements.txt- Pillow
- pymongo
-
Clone the repository and navigate to the project folder:
git clone https://github.com/artur3333/CLI-SocialNet.git cd CLI-SocialNet -
Install the required Python packages:
pip install -r requirements.txt
CLI-SocialNet/
├── main.py # Main application entry point
├── config.json # Configuration settings
├── config_loader.py # Configuration loader
├── auth.py # Authentication & session management
├── db.py # Database abstraction layer
├── database_s.py # SQLite
├── database_m.py # MongoDB
├── posts.py # Post creation & management
├── social.py # Social features (follow, profile, dm)
├── admin.py # Admin & moderation features
├── level.py # XP, levels & achievements
├── ascii.py # ASCII art conversion
├── utils.py # Utility functions & helpers
└── __init__.py # Package initializer
The application uses a config.json file for configuration. On first run, a default configuration file will be automatically created if it doesn't exist.
Edit config.json to customize your installation:
{
"DATABASE": "sqlite",
"SQL_PATH": "socialnet.db",
"MONGODB_URI": "mongodb://localhost:27017/",
"MONGODB_NAME": "socialnet",
"ENABLE_REGISTRATION_LIMIT": true,
"DEFAULT_ADMIN_PASSWORD": "admin123"
}-
Start the application:
python main.py
-
Register a new user:
register <username>You'll be prompted to enter a password.
-
Login:
login <username> -
View available commands:
help -
You can login as an admin user with the username
adminand the default password set inconfig.json. Admins have access to additional moderation commands.
- No additional setup required
- Stores data in
socialnet.dbfile
- Requires MongoDB server installation
Switching to MongoDB:
- Install MongoDB
- Update
config.json:{ "DATABASE": "mongodb", "MONGODB_URI": "mongodb://localhost:27017/" } - Restart the application
Earn XP for various activities:
- Create a post: +10 XP
- Comment: +5 XP
- Like a post: +2 XP
- Repost: +5 XP
- Follow someone: +5 XP
or compleate achievements to gain bonus XP
admin # View dashboard
admin ban [reason] # Ban a user
admin unban # Unban a user
admin deletepost # Delete any post
admin makeadmin # Grant admin rights
admin removeadmin # Remove admin rights
admin verify # Verify a user
admin unverify # Remove verification
admin reports [status] [page] # View reports
admin resolve # Resolve a report
admin dismiss # Dismiss a report
admin logs [page] # View admin action logsUsers can customize their experience:
- Color Scheme: Personalize colors
- Terminal Width: Adjust display width
- Posts per Page: Customize posts shown per page
- Notifications: Configure notification preferences
Access settings with:
settings # View all settings
setting <setting_name> <new_value> # Change a settingCreate your own command shortcuts for existing commands:
alias [alias] [command] # Create an alias
unalias <alias> # Remove an aliasThis project was developed with selective use of AI assistance. Most of the implementation was done independently, with AI mainly used for:
MongoDB Implementation (database_m.py)
- AI was used extensively to help implement the MongoDB backend to speed up the implementation process
- Primary focus was on fixing compatibility issues and bugs.
- Significant use of tab autocomplete (code suggestions)
UI and Layout (utils.py formatting)
- AI assistance was used to help with text wrapping, Unicode alignment and helped debug border rendering in the display UI system
Bug Fixing and Debugging
- AI was consulted when facing difficult bugs, particularly in:
- Comment system implementation
- Database issues
- Alignment and formatting problems
- Other bugs
Documentation
- This README was partially generated by AI and then modified to ensure accuracy.
This project is licensed under the MIT License. See the LICENSE file for details
