Welcome to GamerConnect, the ultimate social media platform for gamers!
GamerConnect is a dynamic and inclusive platform designed for gamers of all ages and backgrounds. Whether you're a seasoned pro or just starting your gaming journey, our platform is tailored to bring the gaming community together.
This is the backend Repo for the frontend repo please click here.
For the live site - https://gamer-connect-625bab79a49e.herokuapp.com/
Game Clips & Screenshots: Share your gaming triumphs, epic moments, and funniest fails with our intuitive media uploading features.
Likes & Follows: Connect with fellow gamers, support their content with likes, and build your own dedicated following.
Find Gamers: Discover like-minded players and create lasting gaming partnerships. Find friends to join you in your gaming adventures!
Community-First Approach: GamerConnect puts the community at the heart of everything we do. We're all about creating connections, friendships, and epic gaming memories.
User-Friendly Interface: Our platform is designed with simplicity in mind, ensuring an easy and enjoyable experience for users of all levels.
Diverse Gaming Experience: No matter your preferred platform, genre, or style, you'll find a welcoming and diverse community here.
This project was executed following agile methodologies, employing incremental sprints to deliver small features.
The project's Kanban board was established using GitHub Projects, and additional details can be accessed here.
This board provides an overview of the project cards and their respective statuses.
I structured the database with PostgreSQL due to its reliability and advanced features.
To visualize and manage the schema, I employed DbVisualizer, enabling a detailed examination of tables and relationships.
As a GamerConnect user, I aim to share my gaming experiences by crafting posts containing images, facilitating connections with the gaming community.
As a GamerConnect user, I aim to share my gaming experiences by crafting posts containing clips and images, facilitating connections with the gaming community.
As a GamerConnect user, I wish to scroll through all the latests posts on the site
As a GamerConnect user, I want to check out individual posts to learn more about interesting gaming posts.
As a GamerConnect user, I want a responsive navbar that allows me to easily move between different pages on the site.
As a GamerConnect user, I want to show my liking for interesting posts to express support.
As a GamerConnect user, I aim to search for posts and user profiles using keywords to find content and gamers matching my interests.
As a GamerConnect user, I want a straightforward way to revisit posts I've liked, making it easy to relive favorite gaming moments
As a post owner on GamerConnect, I aim to have control over the editing of my post title and description to ensure accuracy and updates.
As a GamerConnect user, I want to delete my posts this will allow me to manage my content.
As a GamerConnect user, I intend to contribute to post discussions by adding comments, allowing me to share thoughts and engage with fellow gamers.
As the owner of a comment, I wish to have the capability to delete and edit my comments, allowing me to manage the content within the application.
As a GamerConnect user, I intend to establish a fresh account to access all the privileges available to registered gamers.
As a GamerConnect user, I want to check out fellow gamers' profiles to explore their gaming posts and learn more about their gaming experiences.
As a GamerConnect user, I want to be able to follow and unfollow other gamers.
As a GamerConnect user, when logged in, I want to personalize my gaming identity by changing my profile picture and updating my bio.
As a GamerConnect user, I want to effortlessly find and connect with popular profiles in the gaming community.
As a developer, I need to set up the backend project structure for seamless project development.
As a developer, I must configure the frontend project structure to facilitate project development.
As a developer, I need to guarantee the successful deployment of the project's backend for site accessibility.
As a developer, I must ensure the successful deployment of the project's frontend for users to interact with.
As a developer, it's crucial to create a database and integrate it into the project for effective information storage.
As a GamerConnect user, I want a responsive navbar that allows me to easily move between different pages on the site.
A navigation bar has been implemented, transitioning into a hamburger menu on smaller devices to prevent navigation item overlap. This ensures users can access and navigate the site seamlessly on devices of any size. The navbar is user-friendly, allowing easy navigation and smooth transitions between each page. The Navbar shows distinct icons based on the user's sign-in status, enabling them to easily distinguish whether they are logged in or out.
As a GamerConnect user, I want to create a new account to enjoy all the benefits available to registered users.
A user-friendly sign-up page has been introduced, providing a clear and straightforward registration process. This enables users to register with GamerConnect, establishing a profile for them upon registration. After completing the registration, users are directed to a login page where they can access their account using the created username and password. Once logged in, users gain access to all privileges reserved for the GamerConnect Community.
As a GamerConnect user, I aim to share my gaming experiences by crafting posts with an image, facilitating connections with the gaming community.
For a registered user, a user-friendly form has been developed to effortlessly facilitate post creation. This not only encourages users to express their creativity but also contributes to the growth of the community and enhances the overall application experience. The form has been designed to be straightforward and intuitive, ensuring a seamless and enjoyable posting process for users.
As a GamerConnect user, I aim to share my gaming experiences by crafting posts with a video, facilitating connections with the gaming community.
For a registered user, a user-friendly form has been developed to effortlessly facilitate post creation. This not only encourages users to express their creativity but also contributes to the growth of the community and enhances the overall application experience. The form has been designed to be straightforward and intuitive, ensuring a seamless and enjoyable posting process for users.
As a GamerConnect user, I want to easily browse through the newest posts on the site.
Users can effortlessly navigate through the content available on GamerConnect using the seamlessly designed post page. The interface provides a user-friendly platform where individuals can leisurely scroll through an organized presentation of the freshest posts. This ensures that users indulge in a fluid and instinctive browsing encounter, enhancing their overall exploration of the latest updates and engaging content.
As a GamerConnect user, I want to check out individual posts to learn more about interesting gaming posts.
Upon selecting a post of interest, users are directed to the post view interface, where they can delve into a detailed examination of the individual post. Within this post view, users gain the ability to explore the content more comprehensively and engage further by perusing all associated comments. This seamless transition provides users with an immersive experience, enabling them to interact extensively with the content and participate in the broader community conversation surrounding the post.
As a GamerConnect user, I want to show my liking for interesting posts to express support.
Users have the opportunity to convey their endorsement and encouragement on GamerConnect through the simple yet impactful action of liking posts. This interactive feature serves as a precise gauge, effectively mirroring users' genuine appreciation for captivating and noteworthy content within the platform. Engaging in the process of liking a post has been designed to be effortlessly straightforward, ensuring a seamless and expeditious experience for users, thereby contributing to a user-friendly and enjoyable interaction with the platform.
As a GamerConnect user, I aim to search for posts and user profiles using keywords to find content and gamers matching my interests.
Users can easily find posts and user profiles on GamerConnect by using relevant keywords. The search function accurately retrieves content aligned with the entered keywords, ensuring a simple and smooth experience through the user-friendly interface.
As a GamerConnect post owner, I want to be able to edit my post title and description for accuracy and updates.
Users can easily change their posts by clicking on the options icon on the post and selecting edit, making it simple to keep their content up-to-date. This user-friendly feature ensures quick and accurate updates to titles and descriptions, making the experience dynamic. By allowing easy edits, this encourages users to take charge of their content, adding their own touch and making the community stronger.
As a GamerConnect user, I want to delete my posts this will allow me to manage my content.
Post owners can easily delete their posts with a designated icon. The process is user-friendly and accessible, allowing post owners to manage their content effortlessly.
As a GamerConnect user, I want to join post conversations by commenting, sharing thoughts, and interacting with fellow gamers.
On GamerConnect, users can easily add comments to posts. The platform accurately shows user comments in post discussions. Commenting is simple and user-friendly, encouraging gamers to engage with each other.
As a comment owner, I want to be able to edit and delete my comments, giving me control over the content in the app.
Users who own comments can easily modify their contributions using simple and user-friendly options. The platform seamlessly integrates editing features, allowing individuals to quickly adjust their posts for accuracy or clarity without any hassle. The delete function is seamlessly integrated, providing an efficient way for comment owners to swiftly remove their content. These straightforward processes empowers users to keep their comments relevant and aligned with their intentions.
As a GamerConnect user, I want to effortlessly find and connect with popular profiles in the gaming community.
When users log in, they'll find a section on the homepage highlighting popular profiles with pictures and usernames.
Clicking on a profile thumbnail takes users directly to the detailed profile view, making it easy to discover and connect with influential gamers.
As a GamerConnect user, I want to be able to follow and unfollow other gamers.
Users can easily follow and unfollow other gamers, enhancing their ability to connect within the gaming community. The platform accurately records and displays the user's following status for others, providing transparency in connections and allowing users to manage their network with ease.
I want to explore what games others are playing and showcase my own, So I can connect with fellow gamers looking for friends.
Users can explore the gaming preferences of others and exhibit their own. Game cards provide clear information, including the game title, user details, and whether they're seeking gaming friends.
Here you can find the instructions to recreate the projects
Enter the following in your workspaces terminal (This may take a couple of minuetes).
npx create-react-app . --template git+https://github.com/Code-Institute-Org/cra-template-moments.git --use-npm
Enter npm install in the terminal
Then enter the following to fix issue with CI template:
npm i react-scripts@latest
Enter in ther terminal
npm start
You should see the react logo now open in the local server
Go to Heroku
Load your front end app (gamer-connect)
Open App
Copy URL
Now load your API project (gamer-connect-api)
Go to settings
Reveal config vars
create a new Var and paste the URL in the value:
Key - CLIENT_ORGIN
Value - {{front_end_project_url}}
Now go back to Gitpod
Go to your development server and copy URL
Go back to Heroku
Go to settings
Reveal config vars
create a new Var and paste the URL in the value:
Key - CLIENT_ORGIN_DEV
Value - {{front_end_dev_server_url}}
Note: Gitpod will change the dev server URL every so often so update when needed
Run the following in the terminal:
npm install axios
Create a folder named api in the src folder
create a file named axiosDefaults.js
Setup your api settings, when setting the base URL make sure to use your Heroku backend apps URL.
import axios in to APP.js
add the following to settings.py underneath "from pathlib import Path":
import os
if os.path.exists('env.py'):
import env
CLOUDINARY_STORAGE = {
'CLOUDINARY_URL': os.environ.get('CLOUDINARY_URL')
}
MEDIA_URL = '/media/'
DEFAULT_FILE_STORAGE = 'cloudinary_storage.storage.MediaCloudinaryStorage'
run the following in the terminal - pip3 install dj-rest-auth==2.1.9
Add the following in INSTALLED_APPS in settings.py:
'rest_framework.authtoken',
'dj_rest_auth',
Add the following in the main app (gamer_connect_api) urls.py:
path('dj-rest-auth/', include('dj_rest_auth.urls')),
Now migrate the db with python manage.py migrate
run the following in the terminal - pip freeze > requirements.txt
run the following in the terminal - pip install 'dj-rest-auth-[with_social]'
got to INSTALLED_APPS and add the following:
'django.contrib.sites',
'allauth',
'allauth.account',
'allauth.socialaccount',
'dj_rest_auth.registration',
Underneath INSTALLED_APPS add:
SITE_ID = 1
Add the following in the main app (gamer_connect_api) urls.py:
path('dj-rest-auth/registration/', include('dj_rest_auth.registration.urls')),
run pip freeze > requirements.txt
Run the following in the terminal - pip install djangorestframework-simplejwt
add DEV to env.py
Add the following in settings.py under BASE_DIR :
REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': [(
'rest_framework.authentication.SessionAuthentication'
if 'DEV' in os.environ
else 'dj_rest_auth.jwt_auth.JWTCookieAuthentication'
)]
}
Again in setting.py add the following under REST_FRAMEWORK :
REST_USE_JWT = True
JWT_AUTH_SECURE = True
JWT_AUTH_COOKIE = 'my-app-auth'
JWT_AUTH_REFRESH_COOKIE = 'my-refresh-token'
REST_AUTH_SERIALIZERS = {
'USER_DETAILS_SERIALIZER': 'gamer_connect_api.serializers.CurrentUserSerializer'
}
Create serializers.py and create dj_rest_auth
python manage.py migrate
run pip freeze > requirements.txt
Navigate to https://www.elephantsql.com/
Click Login/Creat a account.
Click "Create New Instance".
Create a name for the instance.
Select Tiny Turtle.
Leave Tags empty and click "Select Region".
Select your region.
Click Review in the bottom right corner.
Click Create instance.
Click on your newly created instance.
Copy the URL of the instance.
Go to Heroku
Click on settings and reveal config vars
set the key as DATABASE_URL and paste in the url in the value :
[DATABASE_URL] [postgres://xxxxxxxxxxxxxxxxxxxxx]
Now go back to your IDE
Run pip3 install dj_database_url==0.5.0 psycopg2 in the terminal
go to settings.py and import dj_database_url underneath the import for os
import os
import dj_database_url
Still in settings.py update the DATABASES section with the following:
if 'DEV' in os.environ:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}
else:
DATABASES = {
default': dj_database_url.parse(os.environ.get("DATABASE_URL"))
}
add you db url to env.py :
os.environ['DATABASE_URL'] = "<your PostgreSQL URL here>"
Temporarly comment out DEV so that the external db can connect to your IDE
Go back to settings.py and add a print satement at the bottom of the database if else statement:
if 'DEV' in os.environ:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}
else:
DATABASES = {
default': dj_database_url.parse(os.environ.get("DATABASE_URL"))
}
print("connected")
-–dry-run your makemigrations with following in the terminal:
python3 manage.py makemigrations --dry-run
if succesful connection is made you should see connected in the terminal
Remove print statement
Run python3 manage.py migrate
Create yourself a super user for the database by running - python3 manage.py createsuperuser
Follow the steps to create your superuser username and password
Confirm this has been added by going back to Elephantsql
click on your instance
select browser in the left navigation
Click the table queries and select auth_user
When you click execute you should now see your new superuser
In the terminal of your IDE run - pip3 install gunicorn django-cors-headers
Run in the terminal - pip freeze --local > requirements.txt
Create a Profile in the top level of the project (Needed for Heroku)
Add the following to the Procfile:
release: python manage.py makemigrations && python manage.py migrate
web: gunicorn gamer_connect_api.wsgi
Go to settings.py and take your Heroku app's URL and add to ALLOWED_HOSTS
ALLOWED_HOSTS = ['localhost', '{{your_app_name}}.herokuapp.com']
Add corsheaders to INSTALLED_APPS underneath dj_rest_auth.registration
INSTALLED_APPS = [
'dj_rest_auth.registration',
'corsheaders',
]
Add corsheaders middleware to the TOP of the MIDDLEWARE
SITE_ID = 1
MIDDLEWARE = [
'corsheaders.middleware.CorsMiddleware',
...
]
Under the MIDDLEWARE list, set the ALLOWED_ORIGINS for the network requests made to the server with the following code:
if 'CLIENT_ORIGIN' in os.environ:
CORS_ALLOWED_ORIGINS = [
os.environ.get('CLIENT_ORIGIN')
]
else:
CORS_ALLOWED_ORIGIN_REGEXES = [
r"^https://.*\.gitpod\.io$",
Enable sending cookies in cross-origin requests to allow users to use authentication.
else:
CORS_ALLOWED_ORIGIN_REGEXES = [
r"^https://.*\.gitpod\.io$",
]
CORS_ALLOW_CREDENTIALS = True
Set the JWT_AUTH_SAMESITE attribute to 'None' to allow the front end and the API to talk between different platforms
JWT_AUTH_COOKIE = 'my-app-auth'
JWT_AUTH_REFRESH_COOKE = 'my-refresh-token'
JWT_AUTH_SAMESITE = 'None'
Remove the default SECRET_KEY and replace with the following to use env.py
SECRET_KEY = os.getenv('SECRET_KEY')
Create a NEW value for your SECRET_KEY environment variable and add it to env.py file:
os.environ.setdefault("SECRET_KEY", "YourNewKey")
Set DEBUG to be True only if the DEV environment variable exists.
DEBUG = 'DEV' in os.environ
Comment DEV back in env.py
Run - pip freeze --local > requirements.txt
Add, Commit & Push to Github
In the form enter following details from your isntance:
Give your DB a name
In the database Server enter your ElephantSql Server but leave out the inastance name in the bracket at the end so it looks like this:
{{name}}.db.elephantsql.com
Take your User & Default database from Elephant SQL and enter it in the Database field and the Database UserId field in DbViusalizar
Keep password source as From Database Password Field
Copy your password from ElephantSQL and enter it in the Database Password field.
Click Connect
Test Steps:
Result: The image uploaded was displayed correctly in the post preview, and the image was visible on the platform as expected.
Test Steps:
Result: An alert error message prevented the post submission without attaching an image, as expected.
Test Steps:
Result: The video uploaded was displayed correctly in the post preview, and the video was visible on the platform as expected.
Test Steps:
Image and Video Upload: A logged-in user can successfully upload both images and videos for their gaming posts.
Post Creation Without Media: A logged-in user is prevented from creating posts without attaching an image or video, triggering an alert.
Test Steps:
Result: A logged-out user attempting to access the use the create a post functionality is redirected to the home page, preventing post creation without authentication, as expected.
Test Steps:
Result: Users can successfully scroll through all the latest posts on the site, as expected.
Test Steps:
Result: Users can successfully view detailed information about an individual post, including post content and comments. Options to like and comment the post are available, as expected.
Test Steps:
Result: The navbar is responsive, showing different icons based on the user's signed-in status. All navbar links are accessible and lead to the correct - pages, as expected.
Test Steps:
Test Steps:
Test Steps:
Result: Users are unable to like their own posts, preventing self-liking as expected.
Test Steps:
Result: Search results include relevant posts and user profiles based on the entered keyword, as expected.
Test Steps:
Result: Search results that dont include relevant posts and user profiles are shown a image and message.
Test Steps:
Result: All liked posts are displayed in the "Liked Posts" section, providing a straightforward way to revisit favorite gaming moments, as expected.
Test Steps:
Result: The user was successfully taken to the edit form, and the post was updated with the new information as expected.
Test Steps:
Result: A confirmation alert appeared, and the post was successfully removed from the platform.
Test Steps:
Result: The comment was successfully added and visible in the comment section.
Test Steps:
Result: The comment was successfully updated, and the deletion confirmation appeared, removing the comment from the post.
Test Steps:
Result: The new account was created successfully, and the user was logged in.
Test Steps:
Result: The user profile displayed relevant information, including posts and user details.
Test Steps:
Result: The user was successfully added to the follower list and removed upon unfollowing.
Test Steps:
Result: The profile was successfully updated with the new information.
Test Steps:
Result: Upon submitting the contact form, the user receives an on-screen message confirming that the message has been successfully received. The message is clear and assures the user that their contact request has been acknowledged.
Test Steps:
Result: The admin can successfully view and access contact requests in the Django admin panel. The integration allows for efficient management of user inquiries.
Test Steps:
Result: Users can successfully create and delete game posts. The information is accurately displayed in the game section and on the user's profile, ensuring that users can share their current gaming preferences and connect with others.
The APIs underwent local testing in the development phase, with the primary testing conducted as an integral part of the front-end repositories. This included manual testing of the actual APIs through form inputs and page loads.
pep8 testing was applied to all folders, revealing several small issues such as lines exceeding length limits, unnecessary blank spaces, indentation problems, and docstring concerns.
All identified issues were addressed, with the exception of extended lines in migration files and settings.
Unit testing was carried out as well on the Posts app following along with the walkthrough material for DRF_API You can find the unit testing here.
Presented below is a comprehensive list of bugs identified during the development phase. Each bug is accompanied by its individual issue story, and you can access a detailed investigation for each one at the provided link.
The identified issue is a known bug preventing the application from opening on Apple mobile devices on various browsers. Specifically, when users attempt to log in, they are redirected back to the login page. This bug stems from the failure to save cookies in the local storage.
For a further release I am looking at resolving this by deploying both the Heroku apps to one domain which I believe will resolve the issue. I have linked in the issue the steps needed to take to do this and will be looking to implement in the new year.
{
"name": "moments",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^11.2.7",
"@testing-library/user-event": "^12.8.3",
"axios": "^0.21.4",
"bootstrap": "^4.6.0",
"jwt-decode": "^3.1.2",
"react": "^17.0.2",
"react-bootstrap": "^1.6.3",
"react-dom": "^17.0.2",
"react-infinite-scroll": "^0.1.5",
"react-infinite-scroll-component": "^6.1.0",
"react-player": "^2.13.0",
"react-router-dom": "^5.3.4",
"react-scripts": "^5.0.1",
"web-vitals": "^1.1.2"
},
asgiref==3.7.2
cloudinary==1.36.0
dj-database-url==0.5.0
dj-rest-auth==2.1.9
Django==3.2.23
django-allauth==0.44.0
django-cloudinary-storage==0.3.0
django-cors-headers==4.3.1
django-filter==23.4
djangorestframework==3.14.0
djangorestframework-simplejwt==5.3.0
gunicorn==21.2.0
oauthlib==3.2.2
Pillow==10.1.0
psycopg2==2.9.9
PyJWT==2.8.0
python-magic==0.4.27
python3-openid==3.2.0
pytz==2023.3.post1
requests-oauthlib==1.3.1
sqlparse==0.4.4
urllib3==1.26.15