├── backend ├── .env.dev ├── handlers │ ├── stats │ │ └── statshandler_test.go │ ├── users │ │ ├── userhelpers │ │ │ ├── encodeemail.go │ │ │ └── generateapikey.go │ │ ├── publicuser.go │ │ ├── listusers.go │ │ ├── publicuser │ │ │ ├── publicuser.go │ │ │ └── publicuser_test.go │ │ ├── README_USERS.md │ │ ├── userpositiononmarkethandler.go │ │ ├── apply_transaction.go │ │ ├── credit │ │ │ ├── usercredit.go │ │ │ └── usercredit_test.go │ │ ├── apply_transaction_test.go │ │ ├── changedescription.go │ │ ├── changedisplayname.go │ │ ├── changeemoji.go │ │ └── privateuser │ │ │ └── privateuser_test.go │ ├── markets │ │ ├── getmarkets.go │ │ └── leaderboard.go │ ├── bets │ │ ├── selling │ │ │ ├── sellingdust.go │ │ │ └── sellpositionhandler.go │ │ ├── errors.go │ │ └── betutils │ │ │ ├── betutils.go │ │ │ ├── validatebet.go │ │ │ ├── feeutils.go │ │ │ └── betutils_test.go │ ├── math │ │ ├── probabilities │ │ │ └── wpam │ │ │ │ ├── wpam_current.go │ │ │ │ └── wpam_current_test.go │ │ ├── README_MATH.md │ │ ├── financials │ │ │ └── workprofits.go │ │ ├── market │ │ │ ├── marketvolume.go │ │ │ └── marketvolume_test.go │ │ ├── positions │ │ │ ├── earliest_users.go │ │ │ └── valuation.go │ │ └── payout │ │ │ └── resolvemarketcore.go │ ├── home.go │ ├── tradingdata │ │ ├── getbets.go │ │ └── getbets_test.go │ ├── metrics │ │ ├── getgloballeaderboard.go │ │ ├── getsystemmetrics.go │ │ └── getsystemmetrics_test.go │ ├── cms │ │ └── homepage │ │ │ └── repo.go │ ├── positions │ │ └── positionshandler.go │ └── setup │ │ └── setuphandler.go ├── seed │ └── home_embed.go ├── util │ ├── apikeys.go │ ├── getenv.go │ ├── modelchecks.go │ └── postgres.go ├── models │ ├── README.md │ ├── homepage.go │ ├── modelstesting │ │ ├── economics_helpers.go │ │ ├── modelstesting_test.go │ │ ├── bets_helpers.go │ │ ├── modelstesting.go │ │ └── users_helpers.go │ ├── bets.go │ ├── market.go │ └── user.go ├── errors │ ├── normalerror.go │ ├── httperror.go │ └── httperror_test.go ├── setup │ ├── setup.yaml │ ├── setuptesting │ │ ├── setuptesting_test.go │ │ └── setuptesting.go │ └── setup_test.go ├── logging │ ├── mocklogging.go │ └── loggingutils.go ├── middleware │ ├── authutils.go │ └── authadmin.go ├── migration │ └── migrations │ │ ├── 20251013_080000_core_models_test.go │ │ ├── 20251013_080000_core_models.go │ │ └── 20251020_140500_add_market_labels.go ├── main.go └── go.mod ├── frontend ├── src │ ├── App.css │ ├── api │ │ ├── axios.js │ │ └── marketsApi.js │ ├── components │ │ ├── layouts │ │ │ ├── admin │ │ │ │ └── AdminUtils.jsx │ │ │ └── profile │ │ │ │ └── ProfileUtility.jsx │ │ ├── stats │ │ │ └── Stats.jsx │ │ ├── register │ │ │ └── Register.jsx │ │ ├── utils │ │ │ ├── Utils.jsx │ │ │ ├── graphicalTools │ │ │ │ ├── GraphDateTimeTools.jsx │ │ │ │ └── GraphToolTips.jsx │ │ │ ├── userFinanceTools │ │ │ │ └── FetchUserCredit.jsx │ │ │ ├── ExpandableLink.jsx │ │ │ ├── ExpandableText.jsx │ │ │ └── dateTimeTools │ │ │ │ └── FormDateTimeTools.jsx │ │ ├── footer │ │ │ └── Footer.jsx │ │ ├── loaders │ │ │ └── LoadingSpinner.jsx │ │ ├── logo │ │ │ └── Logo.jsx │ │ ├── inputs │ │ │ └── InputBox.jsx │ │ ├── profileEdit │ │ │ └── ProfileEdit.jsx │ │ ├── buttons │ │ │ ├── profile │ │ │ │ ├── ProfileButtons.jsx │ │ │ │ ├── ProfileModal.jsx │ │ │ │ ├── DescriptionSelector.jsx │ │ │ │ └── DisplayNameSelector.jsx │ │ │ ├── BaseButton.jsx │ │ │ ├── marketDetails │ │ │ │ ├── DescriptionButton.jsx │ │ │ │ └── ActivityButtons.jsx │ │ │ └── SiteButtons.jsx │ │ ├── tabs │ │ │ ├── ActivityTabs.jsx │ │ │ └── TradeTabs.jsx │ │ ├── TradeCTA.jsx │ │ ├── modals │ │ │ ├── resolution │ │ │ │ └── ResolveUtils.jsx │ │ │ ├── bet │ │ │ │ ├── BetUtils.jsx │ │ │ │ └── BetModal.jsx │ │ │ └── login │ │ │ │ └── LoginModalClick.jsx │ │ ├── datetimeSelector │ │ │ └── DatetimeSelector.jsx │ │ └── resolutions │ │ │ └── ResolutionAlert.jsx │ ├── config.js.template │ ├── assets │ │ ├── png │ │ │ └── HomePageLogo.png │ │ ├── logo │ │ │ ├── socialpredictlogo.png │ │ │ └── socialpredictlogo.webp │ │ └── svg │ │ │ ├── create.svg │ │ │ ├── about.svg │ │ │ ├── profile.svg │ │ │ ├── menu-grow.svg │ │ │ ├── menu-shrink.svg │ │ │ ├── notifications.svg │ │ │ ├── home.svg │ │ │ ├── login.svg │ │ │ ├── logout.svg │ │ │ ├── lock-password.svg │ │ │ ├── markets.svg │ │ │ ├── polls.svg │ │ │ ├── api-key.svg │ │ │ ├── coins.svg │ │ │ └── admin-gear.svg │ ├── config.js │ ├── main.jsx │ ├── helpers │ │ └── formatResolutionDate.js │ ├── pages │ │ ├── polls │ │ │ └── Polls.jsx │ │ ├── notifications │ │ │ └── Notifications.jsx │ │ ├── changepassword │ │ │ └── ChangePassword.jsx │ │ ├── notfound │ │ │ └── NotFound.jsx │ │ ├── admin │ │ │ └── AdminDashboard.jsx │ │ ├── marketDetails │ │ │ ├── MarketDetails.jsx │ │ │ └── marketDetailsUtils.jsx │ │ └── home │ │ │ └── Home.jsx │ ├── utils │ │ ├── statusMap.js │ │ └── chartFormatter.js │ ├── hooks │ │ ├── usePortfolio.jsx │ │ ├── useMarketLabels.js │ │ ├── useMarketDetails.jsx │ │ └── useUserData.jsx │ ├── App.css.backup │ ├── App.jsx │ └── index.css ├── index.css ├── public │ ├── robots.txt │ ├── favicon.ico │ ├── logo192.png │ ├── logo512.png │ ├── HomePageLogo.png │ ├── env-config.js.template │ └── manifest.json ├── postcss.config.js ├── .gitignore ├── vite.config.mjs ├── README.md ├── index.html ├── package.json ├── tailwind.config.js └── README_SPA_ROUTING_FIX.md ├── data ├── nginx │ ├── conf │ │ └── nginx.conf │ └── vhosts │ │ ├── dev │ │ └── default.conf.template │ │ └── prod │ │ └── default.conf.template └── traefik │ └── config │ └── traefik.template ├── README ├── MATH │ ├── Prediction_Market_Math.pdf │ ├── Positions_Calculations.xlsx │ └── README-MATH-POSITIONS.md ├── IMG │ └── logotype_kenyon-purple_rgb.png ├── DEVELOPMENT │ └── DEVELOPMENT.md ├── TROUBLESHOOTING.md ├── CHECKPOINTS │ ├── CHECKPOINT20251105-01.md │ ├── CHECKPOINT20250724-01.md │ └── CHECKPOINT20250803-04.md ├── README-CONFIG.md ├── TESTING │ └── stress_testing │ │ └── docker_stats.csv └── PROJECT_MANAGEMENT │ └── README-ROADMAP.md ├── docker ├── backend │ ├── entrypoint.dev.sh │ ├── Dockerfile.dev │ └── Dockerfile └── frontend │ ├── Dockerfile.dev │ ├── entrypoint.dev.sh │ ├── entrypoint.sh │ ├── Dockerfile │ └── nginx.conf ├── .github ├── go-versions ├── workflows │ ├── deploy-to-staging.yml │ └── deploy-to-production.yml ├── FUNDING.yml └── ISSUE_TEMPLATE │ └── bug_report.md ├── scripts ├── lighthouse │ └── budget.json ├── prod │ └── build_prod.sh ├── prod.sh ├── go.mod ├── lib │ └── arch.sh ├── dev │ └── env_writer_dev.sh ├── docker-compose-dev.yaml └── seed_markets_go.sh ├── SECURITY.md ├── LICENSE ├── .gitignore ├── .env.example └── CONTRIBUTING.md /backend/.env.dev: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/App.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/api/axios.js: -------------------------------------------------------------------------------- 1 | // TBD 2 | -------------------------------------------------------------------------------- /frontend/src/components/layouts/admin/AdminUtils.jsx: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /backend/handlers/stats/statshandler_test.go: -------------------------------------------------------------------------------- 1 | package statshandlers 2 | -------------------------------------------------------------------------------- /backend/handlers/users/userhelpers/encodeemail.go: -------------------------------------------------------------------------------- 1 | package handlers 2 | -------------------------------------------------------------------------------- /backend/handlers/users/userhelpers/generateapikey.go: -------------------------------------------------------------------------------- 1 | package handlers 2 | -------------------------------------------------------------------------------- /data/nginx/conf/nginx.conf: -------------------------------------------------------------------------------- 1 | events { 2 | worker_connections 1024; 3 | } 4 | -------------------------------------------------------------------------------- /frontend/index.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | -------------------------------------------------------------------------------- /frontend/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /frontend/src/config.js.template: -------------------------------------------------------------------------------- 1 | export const DOMAIN_URL = $API_DOMAIN; 2 | export const API_URL = $API_DOMAIN; 3 | -------------------------------------------------------------------------------- /frontend/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openpredictionmarkets/socialpredict/HEAD/frontend/public/favicon.ico -------------------------------------------------------------------------------- /frontend/public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openpredictionmarkets/socialpredict/HEAD/frontend/public/logo192.png -------------------------------------------------------------------------------- /frontend/public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openpredictionmarkets/socialpredict/HEAD/frontend/public/logo512.png -------------------------------------------------------------------------------- /frontend/postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {}, 5 | }, 6 | } 7 | -------------------------------------------------------------------------------- /frontend/public/HomePageLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openpredictionmarkets/socialpredict/HEAD/frontend/public/HomePageLogo.png -------------------------------------------------------------------------------- /README/MATH/Prediction_Market_Math.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openpredictionmarkets/socialpredict/HEAD/README/MATH/Prediction_Market_Math.pdf -------------------------------------------------------------------------------- /backend/handlers/markets/getmarkets.go: -------------------------------------------------------------------------------- 1 | package marketshandlers 2 | 3 | type PublicMarket struct { 4 | MarketID int64 `json:"marketId"` 5 | } 6 | -------------------------------------------------------------------------------- /README/IMG/logotype_kenyon-purple_rgb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openpredictionmarkets/socialpredict/HEAD/README/IMG/logotype_kenyon-purple_rgb.png -------------------------------------------------------------------------------- /README/MATH/Positions_Calculations.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openpredictionmarkets/socialpredict/HEAD/README/MATH/Positions_Calculations.xlsx -------------------------------------------------------------------------------- /docker/backend/entrypoint.dev.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ ! -f /src/.air.toml ]; then 4 | touch /src/.air.toml 5 | fi 6 | 7 | exec air -c .air.toml 8 | -------------------------------------------------------------------------------- /frontend/src/assets/png/HomePageLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openpredictionmarkets/socialpredict/HEAD/frontend/src/assets/png/HomePageLogo.png -------------------------------------------------------------------------------- /frontend/src/assets/logo/socialpredictlogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openpredictionmarkets/socialpredict/HEAD/frontend/src/assets/logo/socialpredictlogo.png -------------------------------------------------------------------------------- /frontend/src/assets/logo/socialpredictlogo.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openpredictionmarkets/socialpredict/HEAD/frontend/src/assets/logo/socialpredictlogo.webp -------------------------------------------------------------------------------- /frontend/public/env-config.js.template: -------------------------------------------------------------------------------- 1 | window.__ENV__ = { 2 | DOMAIN_URL: "${DOMAIN_URL:-http://localhost}", 3 | API_URL: "${API_URL:-http://localhost:8080}" 4 | }; 5 | -------------------------------------------------------------------------------- /frontend/src/components/stats/Stats.jsx: -------------------------------------------------------------------------------- 1 | import React, { useState, useEffect } from 'react'; 2 | 3 | function Stats() { 4 | return "Available Polls" 5 | } 6 | 7 | export default Stats; -------------------------------------------------------------------------------- /backend/handlers/bets/selling/sellingdust.go: -------------------------------------------------------------------------------- 1 | package sellbetshandlers 2 | 3 | func computeSellingDust() { 4 | // dust := redeemRequest.Amount - actualSaleValue // remainder not paid out 5 | } 6 | -------------------------------------------------------------------------------- /frontend/src/components/register/Register.jsx: -------------------------------------------------------------------------------- 1 | import React, { useState, useEffect } from 'react'; 2 | 3 | function Register() { 4 | return "Register Page" 5 | } 6 | 7 | export default Register; -------------------------------------------------------------------------------- /backend/handlers/math/probabilities/wpam/wpam_current.go: -------------------------------------------------------------------------------- 1 | package wpam 2 | 3 | func GetCurrentProbability(probChanges []ProbabilityChange) float64 { 4 | 5 | return probChanges[len(probChanges)-1].Probability 6 | } 7 | -------------------------------------------------------------------------------- /frontend/src/components/utils/Utils.jsx: -------------------------------------------------------------------------------- 1 | const MenuItems = ({ isLoggedIn, onLogout }) => { 2 | const handleLogoutClick = () => { 3 | if (onLogout) { 4 | onLogout(); // Call the onLogout function 5 | } 6 | }; 7 | } -------------------------------------------------------------------------------- /data/nginx/vhosts/dev/default.conf.template: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80; 3 | 4 | location /api/ { 5 | proxy_pass http://backend:8080/; 6 | } 7 | 8 | location / { 9 | proxy_pass http://frontend:5173/; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /frontend/src/components/footer/Footer.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | const Footer = () => { 4 | return ( 5 | 7 | ); 8 | }; 9 | 10 | export default Footer; 11 | -------------------------------------------------------------------------------- /backend/seed/home_embed.go: -------------------------------------------------------------------------------- 1 | package seed 2 | 3 | import _ "embed" 4 | 5 | // Embed the homepage markdown content at compile time 6 | // This ensures the content is available regardless of filesystem layout 7 | // 8 | //go:embed home.md 9 | var defaultHomeMD []byte 10 | -------------------------------------------------------------------------------- /frontend/src/components/loaders/LoadingSpinner.jsx: -------------------------------------------------------------------------------- 1 | const LoadingSpinner = () => ( 2 |
3 |
4 |
5 | ); 6 | 7 | export default LoadingSpinner; 8 | -------------------------------------------------------------------------------- /README/DEVELOPMENT/DEVELOPMENT.md: -------------------------------------------------------------------------------- 1 | ### Recommended Development Setup 2 | 3 | #### IDE 4 | 5 | * We recommend using VSCODE. 6 | * Plugins: 7 | 8 | * [Go for VS Code](https://code.visualstudio.com/docs/languages/go) 9 | 10 | ### Checkint Local Development Documentation 11 | 12 | * [LOCAL_SETUP](README/LOCAL_SETUP.md) -------------------------------------------------------------------------------- /docker/backend/Dockerfile.dev: -------------------------------------------------------------------------------- 1 | FROM golang:1.25.1-alpine3.22 2 | 3 | WORKDIR /src 4 | 5 | RUN go install github.com/air-verse/air@latest 6 | 7 | COPY backend/go.mod backend/go.sum ./ 8 | 9 | RUN go mod download 10 | 11 | COPY docker/backend/entrypoint.dev.sh /entrypoint.sh 12 | 13 | ENTRYPOINT ["/entrypoint.sh"] 14 | -------------------------------------------------------------------------------- /docker/frontend/Dockerfile.dev: -------------------------------------------------------------------------------- 1 | FROM node:22.20.0-alpine3.22 AS builder 2 | 3 | WORKDIR /app 4 | 5 | COPY frontend/package.json frontend/package-lock.json ./ 6 | 7 | RUN npm install 8 | 9 | COPY frontend/ . 10 | 11 | COPY docker/frontend/entrypoint.dev.sh /entrypoint.sh 12 | 13 | ENTRYPOINT ["/entrypoint.sh"] 14 | -------------------------------------------------------------------------------- /frontend/src/config.js: -------------------------------------------------------------------------------- 1 | export const DOMAIN_URL = (typeof window !== 'undefined' && window.__ENV__ && window.__ENV__.DOMAIN_URL) ? window.__ENV__.DOMAIN_URL : 'http://localhost'; 2 | export const API_URL = (typeof window !== 'undefined' && window.__ENV__ && window.__ENV__.API_URL) ? window.__ENV__.API_URL : 'http://localhost'; 3 | -------------------------------------------------------------------------------- /frontend/src/main.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom/client'; 3 | import App from './App'; 4 | import './index.css'; 5 | 6 | const root = ReactDOM.createRoot(document.getElementById('root')); 7 | root.render( 8 | 9 | 10 | 11 | ); 12 | -------------------------------------------------------------------------------- /backend/handlers/math/README_MATH.md: -------------------------------------------------------------------------------- 1 | ### Conventions 2 | 3 | #### Convention 20250619 63F24852-26DA-4816-B494-AB41F622C38E 4 | 5 | * All math should be moved to the math directory, each area separated by package. 6 | * Handlers should become purely ways to interact with the server and API and should contain little to no budiness logic. -------------------------------------------------------------------------------- /frontend/src/helpers/formatResolutionDate.js: -------------------------------------------------------------------------------- 1 | const formatResolutionDate = (resolutionDateTime) => { 2 | const now = new Date(); 3 | const resolutionDate = new Date(resolutionDateTime); 4 | 5 | return resolutionDate < now ? 'Closed' : resolutionDate.toLocaleDateString(); 6 | }; 7 | 8 | export default formatResolutionDate; 9 | -------------------------------------------------------------------------------- /.github/go-versions: -------------------------------------------------------------------------------- 1 | # One entry per line. Two formats supported: 2 | # file: -> reads the language version from that go.mod 3 | # -> exact or x-wildcard like 1.26.x 4 | # 5 | # Default (if this file is missing): file:backend/go.mod 6 | 7 | file:backend/go.mod 8 | #1.26.x 9 | #1.25.x 10 | -------------------------------------------------------------------------------- /backend/util/apikeys.go: -------------------------------------------------------------------------------- 1 | package util 2 | 3 | import ( 4 | "github.com/google/uuid" 5 | "gorm.io/gorm" 6 | ) 7 | 8 | func GenerateUniqueApiKey(db *gorm.DB) string { 9 | for { 10 | apiKey := uuid.NewString() 11 | if count := CountByField(db, "api_key", apiKey); count == 0 { 12 | return apiKey 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /scripts/lighthouse/budget.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "path": "/*", 4 | "resourceSizes": [ 5 | { 6 | "resourceType": "document", 7 | "budget": 18 8 | }, 9 | { 10 | "resourceType": "total", 11 | "budget": 200 12 | } 13 | ] 14 | } 15 | ] -------------------------------------------------------------------------------- /frontend/src/components/utils/graphicalTools/GraphDateTimeTools.jsx: -------------------------------------------------------------------------------- 1 | const FormatDateForAxis = (unixTime) => { 2 | const date = new Date(unixTime); 3 | const day = date.getDate(); 4 | const month = date.toLocaleString('en-US', { month: 'short' }); // 'short' gives the three-letter abbreviation 5 | return `${day}-${month.toUpperCase()}`; // Formats the date as DD-MMM 6 | }; 7 | 8 | export default FormatDateForAxis; -------------------------------------------------------------------------------- /frontend/src/assets/svg/create.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /frontend/src/assets/svg/about.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/assets/svg/profile.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /backend/models/README.md: -------------------------------------------------------------------------------- 1 | ### Conventions 2 | 3 | #### Convention 20250619 7652196C-216A-4CE5-9119-BB59169A767F 4 | 5 | * Any function used to simply extract information from a model should be moved down to the models directory and package. 6 | * For example a function used to simply extract PublicUser information should sit in models within the users directory. 7 | * If there are model specific packages for example usermodel then it should sit there. -------------------------------------------------------------------------------- /frontend/src/assets/svg/menu-grow.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/assets/svg/menu-shrink.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /data/nginx/vhosts/prod/default.conf.template: -------------------------------------------------------------------------------- 1 | server { 2 | gzip on; 3 | gzip_min_length 1000; 4 | gunzip on; 5 | gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript; 6 | 7 | listen 80; 8 | server_name ${DOMAIN}; 9 | 10 | location /api/ { 11 | proxy_pass http://backend:8080/; 12 | } 13 | 14 | location / { 15 | proxy_pass http://frontend:80; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /frontend/src/assets/svg/notifications.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/assets/svg/home.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/assets/svg/login.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/assets/svg/logout.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/pages/polls/Polls.jsx: -------------------------------------------------------------------------------- 1 | import { API_URL } from '../../config'; 2 | import React from 'react'; 3 | import '../../App.css'; 4 | 5 | function Polls() { 6 | return ( 7 |
8 |
9 |

Polls

10 |
11 |
Coming Soon...
12 |
13 | ); 14 | } 15 | 16 | export default Polls; 17 | -------------------------------------------------------------------------------- /backend/errors/normalerror.go: -------------------------------------------------------------------------------- 1 | package errors 2 | 3 | import ( 4 | "log" 5 | ) 6 | 7 | // ErrorLogger logs an error and returns a boolean indicating whether an error occurred. 8 | func ErrorLogger(err error, errMsg string) bool { 9 | if err != nil { 10 | log.Printf("Error: %s - %s\n", errMsg, err) // Combine your custom message with the error's message. 11 | return true // Indicate that an error was handled. 12 | } 13 | return false // No error to handle. 14 | } 15 | -------------------------------------------------------------------------------- /frontend/src/assets/svg/lock-password.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /scripts/prod/build_prod.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Make sure the script can only be run via SocialPredict Script 4 | [ -z "$CALLED_FROM_SOCIALPREDICT" ] && { echo "Not called from SocialPredict"; exit 42; } 5 | 6 | # Pull images 7 | echo "Pulling images ..." 8 | $COMPOSE --env-file "$SCRIPT_DIR"/.env --file "$SCRIPT_DIR/scripts/docker-compose-prod.yaml" pull 9 | echo 10 | 11 | echo "Images pulled." 12 | echo 13 | echo "Your admin credentials are:" 14 | echo "Username: admin" 15 | echo "Password: $ADMIN_PASS" 16 | -------------------------------------------------------------------------------- /backend/handlers/home.go: -------------------------------------------------------------------------------- 1 | package handlers 2 | 3 | import ( 4 | "fmt" 5 | "net/http" 6 | ) 7 | 8 | func HomeHandler(w http.ResponseWriter, r *http.Request) { 9 | if r.Method != http.MethodGet { 10 | http.Error(w, "Method is not supported.", http.StatusNotFound) 11 | return 12 | } 13 | 14 | // Set the Content-Type header to indicate a JSON response 15 | w.Header().Set("Content-Type", "application/json") 16 | 17 | // Send a JSON-formatted response 18 | fmt.Fprint(w, `{"message": "Data From the Backend!"}`) 19 | 20 | } 21 | -------------------------------------------------------------------------------- /frontend/src/pages/notifications/Notifications.jsx: -------------------------------------------------------------------------------- 1 | import { API_URL } from '../../config'; 2 | import React from 'react'; 3 | import '../../App.css'; 4 | 5 | function Notifications() { 6 | return ( 7 |
8 |
9 |

Notifications

10 |
11 |
Coming soon...
12 |
13 | ); 14 | } 15 | 16 | export default Notifications; -------------------------------------------------------------------------------- /docker/frontend/entrypoint.dev.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -eu 3 | 4 | TEMPLATE="/app/public/env-config.js.template" 5 | TARGET="/app/public/env-config.js" 6 | 7 | # Defaults if not set 8 | : "${DOMAIN_URL:=http://localhost}" 9 | : "${API_URL:=http://localhost:8080}" 10 | 11 | if [ -f "$TEMPLATE" ]; then 12 | cp "$TEMPLATE" "$TARGET" 13 | 14 | sed -i "s|\${DOMAIN_URL:-http://localhost}|${DOMAIN_URL}|g" "$TARGET" 15 | sed -i "s|\${API_URL:-http://localhost:8080}|${DOMAIN_URL}:${BACKEND_PORT}|g" "$TARGET" 16 | fi 17 | 18 | exec npm run start 19 | -------------------------------------------------------------------------------- /docker/backend/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM golang:1.25.1-alpine3.22 AS builder 2 | 3 | WORKDIR /src 4 | COPY backend/go.mod backend/go.sum ./ 5 | RUN go mod download 6 | COPY backend/ . 7 | RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o /app/server . 8 | 9 | FROM alpine:3.22.1 10 | 11 | RUN addgroup -S app && adduser -S -G app app 12 | COPY --from=builder /app/server /usr/local/bin/server 13 | RUN chown app:app /usr/local/bin/server 14 | USER app 15 | ENV BACKEND_PORT=8080 16 | EXPOSE 8080 17 | ENTRYPOINT ["/usr/local/bin/server"] 18 | -------------------------------------------------------------------------------- /frontend/src/components/logo/Logo.jsx: -------------------------------------------------------------------------------- 1 | const Logo = () => { 2 | return ( 3 | 4 | 9 | SP 10 | 11 | 12 | ); 13 | }; 14 | 15 | export default Logo; -------------------------------------------------------------------------------- /frontend/src/assets/svg/markets.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/pages/changepassword/ChangePassword.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ChangePasswordLayout from '../../components/layouts/changepassword/ChangePasswordLayout'; 3 | 4 | function ChangePassword() { 5 | 6 | 7 | return ( 8 |
9 |
10 |
11 | 12 |
13 |
14 |
15 | ); 16 | } 17 | 18 | export default ChangePassword; 19 | -------------------------------------------------------------------------------- /scripts/prod.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Make sure the script can only be run via SocialPredict Script 4 | [ -z "$CALLED_FROM_SOCIALPREDICT" ] && { echo "Not called from SocialPredict"; exit 42; } 5 | 6 | # Check for .env file 7 | export CALLED_FROM_SOCIALPREDICT=yes 8 | source "$SCRIPT_DIR/scripts/prod/env_writer_prod.sh" 9 | _main 10 | unset CALLED_FROM_SOCIALPREDICT 11 | 12 | source_env 13 | 14 | sleep 1; 15 | 16 | # Build Docker Images 17 | export CALLED_FROM_SOCIALPREDICT=yes 18 | source "$SCRIPT_DIR/scripts/prod/build_prod.sh" 19 | unset CALLED_FROM_SOCIALPREDICT 20 | -------------------------------------------------------------------------------- /frontend/src/components/inputs/InputBox.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | const RegularInputBox = ({ 4 | value, 5 | onChange, 6 | name, 7 | placeholder, 8 | className, 9 | ...props 10 | }) => { 11 | return ( 12 |