{"id":25039119,"url":"https://github.com/holasoymas/blogit","last_synced_at":"2025-03-30T21:26:35.035Z","repository":{"id":269279331,"uuid":"850516939","full_name":"holasoymas/blogit","owner":"holasoymas","description":"A mini blogging web app in js, php for semester project","archived":false,"fork":false,"pushed_at":"2024-12-24T08:52:18.000Z","size":264,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-06T02:08:11.218Z","etag":null,"topics":["blogging-platform","collage-project","semester-project","university-project","webapp"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/holasoymas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-01T02:09:23.000Z","updated_at":"2024-12-27T10:20:38.000Z","dependencies_parsed_at":"2024-12-22T12:20:07.566Z","dependency_job_id":"b8b7cace-d645-47bf-aa3a-c3f56b1ffd23","html_url":"https://github.com/holasoymas/blogit","commit_stats":null,"previous_names":["holasoymas/blogit"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holasoymas%2Fblogit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holasoymas%2Fblogit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holasoymas%2Fblogit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/holasoymas%2Fblogit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/holasoymas","download_url":"https://codeload.github.com/holasoymas/blogit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246381494,"owners_count":20768038,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blogging-platform","collage-project","semester-project","university-project","webapp"],"created_at":"2025-02-06T02:08:17.138Z","updated_at":"2025-03-30T21:26:35.007Z","avatar_url":"https://github.com/holasoymas.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Blogit (Mini blogging platform created in php and javascript)\n\nThis is a semester project of TU(Trivhuvan University) **Project I** of _4th semester_.\n\n## Entities\n\n- Database\n  ```sql\n  CREATE DATABASE IF NOT EXISTS blogit;\n  ```\n- Users\n\n  ```sql\n  CREATE TABLE IF NOT EXISTS users (\n  id CHAR(36) PRIMARY KEY DEFAULT (UUID()),\n  fname VARCHAR(20) NOT NULL,\n  lname VARCHAR(20) NOT NULL,\n  dob DATE NOT NULL,\n  email VARCHAR(50) NOT NULL UNIQUE,\n  password VARCHAR(50) NOT NULL,\n  profile_pic VARCHAR(10) NOT NULL\n  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP\n  );\n  ```\n\n- Blogs\n\n  ```sql\n  CREATE TABLE IF NOT EXISTS blogs (\n    pid CHAR(36) PRIMARY KEY DEFAULT (UUID()),\n    uid CHAR(36) NOT NULL,  -- Match the data type with 'id' in users table\n    title VARCHAR(255) NOT NULL,\n    content TEXT NOT NULL,\n    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n    FOREIGN KEY (uid) REFERENCES users(id) ON DELETE CASCADE\n  );\n\n  ```\n\n- Comments\n\n  ```sql\n  CREATE TABLE IF NOT EXISTS comments (\n    cid char(36) PRIMARY KEY DEFAULT (UUID()) ,\n    blog_id char(36) NOT NULL,\n    user_id char(36) NOT NULL,\n    comment varchar(100) NOT NULL,\n    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n    FOREIGN KEY (blog_id) REFERENCES blogs(pid) ON DELETE CASCADE,\n    FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE\n  );\n  ```\n\n- Likes\n\n  ```sql\n  CREATE TABLE IF NOT EXISTS likes (\n    lid char(36) PRIMARY KEY DEFAULT (UUID()),\n    bid char(36) NOT NULL,\n    uid char(36) NOT NULL,\n    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n    FOREIGN KEY (bid) REFERENCES blogs(pid) ON DELETE CASCADE,\n    FOREIGN KEY (uid) REFERENCES users(id) ON DELETE CASCADE\n  );\n  ```\n\n- Request For Block (Users)\n\n```sql\n   CREATE TABLE IF NOT EXISTS blocks (\n    block_id char(36) PRIMARY KEY DEFAULT (uuid()),\n    block_by char(36) NOT NULL,\n    block_to char(36) NOT NULL,\n    message VARCHAR(200) NOT NULL,\n    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n    FOREIGN KEY (block_by) REFERENCES users(id) ON DELETE CASCADE,\n    FOREIGN KEY (block_to) REFERENCES users(id) ON DELETE CASCADE,\n   );\n```\n\n- Request For Block (Blogs)\n\n```sql\n  CREATE TABLE IF NOT EXISTS report_blogs(\n  report_id char(36)  PRIMARY KEY DEFAULT (uuid()),\n  reported_blog char(36) NOT NULL,\n  reported_by char(36) NOT NULL,\n  report_reason VARCHAR(200) NOT NULL,\n  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n  FOREIGN KEY(reported_by) REFERENCES users(id) ON DELETE CASCADE,\n  FOREIGN KEY(reported_blog) REFERENCES blogs(pid) ON DELETE CASCADE,\n);\n```\n\n- About us page (Managed by admin only)\n\n```sql\n  CREATE TABLE about_us (\n  id INT AUTO_INCREMENT PRIMARY KEY,\n  content LONGTEXT NOT NULL,\n  last_updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP\n);\n```\n\n- Privacy Policy Page (Managed by admin only)\n\n```sql\n  CREATE TABLE privacy_policy (\n  id INT AUTO_INCREMENT PRIMARY KEY,\n  content LONGTEXT NOT NULL,\n  last_updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP\n);\n```\n\n## Admin Part\n\nAdmin part is in **_blogit/backend/public/admin_** where it is a protected route.\nWe have used built in apache feature to make it protected.\n\nTo do so install _(in linux)_\n\n```bash\nsudo apt-get apache2-utils\n```\n\ncreate a file `.htpasswd` where you can store username and password to that protected route\n\n⚠️ **_WARNING_** : For security reasons, place it outside of where the browser can access, typically outside the htdocs folder.\n\n```bash\nsudo htpasswd -c /opt/lampp/.htpasswd username\n# You will be prompted to type a password\n\n```\n\ncreate a `htaccess` file in a protected folder here in our case in **_/blogit/backend/public/admin_**\nAnd paste the below code.\n\n```\nAuthType Basic # type of authentication\nAuthName \"Admin Area\" # name displayed on login board\nAuthUserFile /opt/lampp/.htpasswd # path where password is stored\nRequire valid-user # only valid-user can go further\n```\n\nNow when you go to the route you will be prompted to give username and password\nEnter earlier username and password stroed in .htpasswd and you are good to go.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fholasoymas%2Fblogit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fholasoymas%2Fblogit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fholasoymas%2Fblogit/lists"}