Skip to content

Programming-Simplified-Community/Social-Coder

Repository files navigation

Status

CodeQL MegaLinter

Social Coder

This project is geared towards building a social-media like experience for programmers!

Clearly, this is a work in progress app but here's a sneak peak on current progress! WIP Code Jam Topics

  1. OAuth login via Google or Discord (will add more)
  2. Ability to view code jams
  3. Ability to register/withdraw from code jams

If you're interested in contributing here's Environment setup instructions/suggestions.

Of course, no app is complete without a Database!

Scripts

Before starting the database via docker-compose we need to setup some environment variables.

There are a few parameters you can specify if you want... running it with no parameters will use default values for our connection string! Which is fine...

View Script

Please note this will override previously set values if you don't respecify them! Additionally, this script will automatically update your connection string.

./create-env.ps1

./create-env.ps1 -databasePath Path\To\Where\You\Want\To\Store\Db

Start database from docker-compose

./start-db.ps1

Create https-certs. Depending on your environment your IDE might have already set this up for you. Otherwise, this script will do the trick... hopefully

./create-https-certs.ps1

Services

After some research we have determined that we needed something a bit better than standard REST endpoints between our client and server. Though we're noobs to implement GraphQL, it looks like an excellent long-term solution for loading an entire pages worth of data in one go... compared to calling N amount of endpoints for N components on screen.

graph TD
    Client[Client] --- GraphQL[GraphQL]
    GraphQL --- Server
    Server --- Postgres[Postgres DB]
Loading

Login

There are no default credentials. Must utilize OAuth.

OAuth Setup

Will require adding a appsettings.development.json to your Server project SocialCoder.Web

{
  "Authentication": {
    "ProviderName": {
      "ClientId": "",
      "ClientSecret": ""
    }
  }
}

Right now we have Discord and Google setup for our application. A requirement to set this up will be to register with the following services:

Discord

Discord Developer Portal

  • Create an application (if you don't have one already)
  • Go to OAuth2 panel
    • Grab both the Client ID and Client Secret and put them into the appropriate place in your appsettings.development.json. The ProviderName for this will be Discord... because....it's... discord.
    • Update the redirect to be https://localhost:7159/signin-discord

Google

Google Portal

  • Create a project to use for testing
  • Go to API & Services --> Credentials
    • Create Credentials
      • Add Authorized JavaScript origins: https://localhost:7159
      • Authorized Redirect URIs: https://localhost:7159/signin-google
      • Save and grab the Client ID and Client Secret. Shove this into Google. Should be self explanatory that the pattern here is ProviderName equals the Service name we're using for OAuth.

Github

Register Github App