{"id":25304752,"url":"https://github.com/phyohtetarkar/bookshop","last_synced_at":"2025-10-28T08:31:29.929Z","repository":{"id":193303757,"uuid":"688532504","full_name":"phyohtetarkar/bookshop","owner":"phyohtetarkar","description":"Online shop app build with reactjs and firebase","archived":false,"fork":false,"pushed_at":"2023-09-10T04:17:01.000Z","size":9778,"stargazers_count":8,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-04T00:22:33.599Z","etag":null,"topics":["ecommerce","firebase","nextjs","reactjs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/phyohtetarkar.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":"2023-09-07T14:41:04.000Z","updated_at":"2024-07-05T04:48:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"5c71a855-ba8e-41da-9679-5405ec1d6614","html_url":"https://github.com/phyohtetarkar/bookshop","commit_stats":null,"previous_names":["phyohtetarkar/bookshop"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/phyohtetarkar/bookshop","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phyohtetarkar%2Fbookshop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phyohtetarkar%2Fbookshop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phyohtetarkar%2Fbookshop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phyohtetarkar%2Fbookshop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phyohtetarkar","download_url":"https://codeload.github.com/phyohtetarkar/bookshop/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phyohtetarkar%2Fbookshop/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281409235,"owners_count":26496351,"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","status":"online","status_checked_at":"2025-10-28T02:00:06.022Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["ecommerce","firebase","nextjs","reactjs"],"created_at":"2025-02-13T08:30:55.382Z","updated_at":"2025-10-28T08:31:28.516Z","avatar_url":"https://github.com/phyohtetarkar.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bookshop\n\n## Environmental variable file\n\nFor admin (.env.local)\n```env\nREACT_APP_FIREBASE_API_KEY=\u003capi-key\u003e\n\nREACT_APP_FIREBASE_STORAGE_PATH=https://firebasestorage.googleapis.com/v0/b/\u003cyour-bucket-id\u003e/o\n```\n\nFor consumer (.env.local)\n```env\nNEXT_PUBLIC_APP_NAME=Shop Name\n\nNEXT_PUBLIC_FIREBASE_API_KEY=\u003capi-key\u003e\n\nNEXT_PUBLIC_FIREBASE_STORAGE_PATH=https://firebasestorage.googleapis.com/v0/b/\u003cyour-bucket-id\u003e/o\n\nNEXT_PUBLIC_FACEBOOK_PAGE_ID=\u003cfacebook-page-id\u003e\n```\n## Data model\n```json\n{\n    \"banner\": [\n        \"homeBanner\": {\n            \"images\": \"\u003cstring-array\u003e\",\n        },\n    ],\n\n    \"category\": {\n        \"id\": \"\u003cstring\u003e\",\n        \"name\": \"\u003cstring\u003e\",\n        \"createdAt\": \"\u003clong\u003e\",\n        \"createdBy\": \"\u003cstring\u003e\",\n        \"updatedAt\": \"\u003clong\u003e\",\n        \"updatedBy\": \"\u003cstring\u003e\"\n    },\n\n    \"author\": {\n        \"id\": \"\u003cstring\u003e\",\n        \"name\": \"\u003cstring\u003e\",\n        \"createdAt\": \"\u003clong\u003e\",\n        \"createdBy\": \"\u003cstring\u003e\",\n        \"updatedAt\": \"\u003clong\u003e\",\n        \"updatedBy\": \"\u003cstring\u003e\"\n    },\n\n    \"book\": {\n        \"id\": \"\u003cstring\u003e\",\n        \"name\": \"\u003cstring\u003e\",\n        \"nameLowercase\": \"\u003cstring\u003e\",\n        \"price\": \"\u003cnumber\u003e\",\n        \"discount\": {\n            \"value\": \"\u003cnumber\",\n            \"type\": \"percent | fixed\"\n        },\n        \"isDiscount\": \"\u003cboolean\u003e\",\n        \"newArrival\": \"\u003cboolean\u003e\",\n        \"popular\": \"\u003cboolean\u003e\",\n        \"available\": \"\u003cboolean\u003e\",\n        \"code\": \"\u003cstring\u003e\",\n        \"publishedYear\": \"\u003cnumber\u003e\",\n        \"numberOfPages\": \"\u003cnumber\u003e\",\n        \"publisher\": \"\u003cstring\u003e\",\n        \"edition\": \"\u003cstring\u003e\",\n        \"images\": \"\u003cstring-array\u003e\",\n        \"hidden\": \"\u003cboolean\u003e\",\n        \"description\": \"\u003chtml-string\u003e\",\n        \"category\": \"\u003ccategoryId\u003e\",\n        \"author\": \"\u003cauthorId\u003e\",\n        \"createdAt\": \"\u003clong\u003e\",\n        \"createdBy\": \"\u003cstring\u003e\",\n        \"updatedAt\": \"\u003clong\u003e\",\n        \"updatedBy\": \"\u003cstring\u003e\"\n    },\n\n    \"order\": {\n        \"id\": \"\u003cstring\u003e\",\n        \"orderNumber\": \"\u003cstring\u003e\",\n        \"customer\": \"\u003cstring\u003e\",\n        \"phoneNumber\": \"\u003cstring\u003e\",\n        \"address\": \"\u003cstring\u003e\",\n        \"totalProduct\": \"\u003cnumber\u003e\",\n        \"subtotal\": \"\u003cnumber\u003e\",\n        \"totalPrice\": \"\u003cnumber\u003e\",\n        \"discount\": \"\u003cnumber\u003e\",\n        \"deliveryFee\": \"\u003cnumber\u003e\",\n        \"status\": \"\u003cstring\u003e\",\n        \"items\": [\n            {\n                \"quantity\": \"\u003cnumber\u003e\",\n                \"unitPrice\": \"\u003cnumber\u003e\",\n                \"discount\": \"\u003cnumber\u003e\",\n                \"price\": \"\u003cnumber\u003e\",\n                \"productId\": \"\u003cstring\u003e\",\n                \"product:\": \"\u003cembedded\u003e\"\n            }\n        ],\n        \"createdAt\": \"\u003clong\u003e\",\n        \"updatedAt\": \"\u003clong\u003e\",\n        \"updatedBy\": \"\u003cstring\u003e\"\n    },\n\n    \"notification\": {\n        \"id\": \"\u003cstring\u003e\",\n        \"title\": \"\u003cstring\u003e\",\n        \"description\": \"\u003cstring\u003e\",\n        \"createdAt\": \"\u003clong\u003e\",\n        \"createdBy\": \"\u003cstring\u003e\"\n    },\n\n    \"setting\": {\n        \"generalSetting\": {\n            \"aboutUs\": \"\u003cstring\u003e\",\n            \"termsAndConditions\": \"\u003cstring\u003e\",\n            \"appStoreUrl\": \"\u003cstring\u003e\",\n            \"playStoreUrl\": \"\u003cstring\u003e\",\n            \"contact\": {\n                \"phoneNumbers\": \"\u003carray\u003e\",\n                \"email\": \"\u003cstring\u003e\",\n                \"address\": \"\u003cstring\u003e\",\n                \"location\": {\n                    \"lat\": \"\u003cdouble\u003e\",\n                    \"lon\": \"\u003cdouble\u003e\"\n                }\n            },\n            \"socialMedias\": {\n                \"facebook\": \"\u003cstring\u003e\",\n                \"twitter\": \"\u003cstring\u003e\",\n                \"instagram\": \"\u003cstring\u003e\"\n            },\n            \"updatedAt\": \"\u003clong\u003e\",\n            \"updatedBy\": \"\u003cstring\u003e\"\n        },\n        \"productSetting\": {\n            \"publishers\": \"\u003carray\u003e\",\n            \"editions\": \"\u003carray\u003e\",\n            \"updatedAt\": \"\u003clong\u003e\",\n            \"updatedBy\": \"\u003cstring\u003e\"\n        },\n        \"orderSetting\": {\n            \"minimumOrderLimitPerProduct\": \"\u003cnumber\u003e\",\n            \"payments\": [\n                {\n                    \"method\": \"\u003cstring\u003e\",\n                    \"number\": \"\u003cstring\u003e\"\n                }\n            ],\n            \"updatedAt\": \"\u003clong\u003e\",\n            \"updatedBy\": \"\u003cstring\u003e\"\n        }\n    }\n}\n```\n\n## Firebase setup\n\n### Authentication\n\nThis project use firebase auth for admin login with email and password. This project manually need to create admin users in firebase auth. After you created users, you need admin users' **uid** for security rule setup up to restrict your resources (firestore and storage) access.\n\n1. Setup firebase auth\n2. Add admin users manually with email and password\n3. Add a collection naming **users** in firestore\n4. Add document to **users** collection with **id** and field **admin** for each auth users\n   - **id** (uid from firebase auth)\n   - **admin** (boolean type with value *true*)\n\n### Firestore\n\nCollections as shown in **data model**\n\n- banners\n- authors\n- categories\n- books\n- orders\n- users\n- settings\n\n\u003e [!NOTE]\n\u003e You will also need to create firestore composite indexes for **books** and **orders** for data query filtering.\n\n```bash\n# Security rule\nrules_version = '2';\nservice cloud.firestore {\n  match /databases/{database}/documents {\n    function isAdmin() {\n      return get(/databases/$(database)/documents/users/$(request.auth.uid)).data.admin == true;\n    }\n\n    match /orders/{document=**} {\n    \tallow create: if true;\n    }\n    \n    match /{document=**} {\n      allow read: if true;\n      allow write: if isAdmin();\n    }\n  }\n}\n```\n\n### Storage\n\nThis project need to create **banners** and **books** folders for storing images.\n\n\n```bash\n# Security rule\nrules_version = '2';\nservice firebase.storage {\n  match /b/{bucket}/o {\n    function canAccess() {\n      return request.auth.uid in ['your-admin-uids'];\n    }\n    \n    match /{allPaths=**} {\n      allow read: if true;\n      allow write: if canAccess(); \n    }\n  }\n}\n```\n\n## Screenshots\n\n\u003cimg src=\"home.png\"\u003e\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphyohtetarkar%2Fbookshop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphyohtetarkar%2Fbookshop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphyohtetarkar%2Fbookshop/lists"}