Hello there, and thanks for contributing to Shlinkedin! This document is largely based off Phoenix and is a work in progress.
Shlinkedin, as you can tell, is young -- there are lots of features to build, bugs to fix, and tests to write. So your help is invaluable!
Here are the best ways to contribute, in order of importance:
Once you pick something to contribute, here's how I suggest you go about it:
Join the discord! This is where the action happens. We are doing this in our spare time and could use a lot of help that isn't writing code.
All of the above are very valuable to us right now!
Good bug reports are extremely helpful - thank you! Shlinkedin is quite buggy right now, and I expect it to remain that way as we scale. If you find a bug, the best way to report it is in the bugs channel on our discord. If you want to try fixing it yourself (which is the best outcome for me), create a pull request.
Feature requests (and feedback in general) is very welcome. Please provide as much detail and context as possible. The best place to request a feature is in the features channel on our discord. I'll try and respond and add it to the roadmap if we think it makes sense.
If you want to add a feature yourself (highly encouraged, create a pull request).
Good pull requests - patches, improvements, new features - are a fantastic help. They should remain focused in scope and avoid containing unrelated commits.
IMPORTANT: By submitting a patch, you agree that your work will be licensed under the license used by the project.
If you have any large pull request in mind (e.g. implementing features, refactoring code, etc), please ask first otherwise you risk spending a lot of time working on something that wemight not want to merge into the project.
Please adhere to the coding conventions in the project (indentation, accurate comments, etc.) and don't forget to add your own tests and documentation. When working with git, we recommend the following process in order to craft an excellent pull request:
Fork the project, clone your fork, and configure the remotes:
# Clone your fork of the repo into the current directory
git clone https://github.com/<your-username>/shlinked
# Navigate to the newly cloned directory
cd shlinked
# Assign the original repo to a remote called "upstream"
git remote add upstream https://github.com/cbh123/shlinked
If you cloned a while ago, get the latest changes from upstream, and update your fork:
git checkout main
git pull upstream main
git push
Create a new topic branch (off of main
) to contain your feature, change,
or fix.
IMPORTANT: Making changes in main
is discouraged. You should always
keep your local main
in sync with upstream main
and make your
changes in topic branches.
git checkout -b <topic-branch-name>
Commit your changes in logical chunks. Keep your commit messages organized, with a short description in the first line and more detailed information on the following lines. Feel free to use Git's interactive rebase feature to tidy up your commits before making them public.
Make sure all the tests are still passing.
mix test
Push your topic branch up to your fork:
git push origin <topic-branch-name>
Open a Pull Request with a clear title and description.
If you haven't updated your pull request for a while, you should consider rebasing on master and resolving any conflicts.
Thank you for your contributions!
To start your Phoenix server:
mix deps.unlock --all; mix deps.update --all; mix deps.get
mix ecto.setup
. (You may need to first create a postgres user with the credentials listed in ./config/dev.exs — see this page for more info.)cd assets
and install Node.js dependencies with npm install
or yarn install
mix phx.server
Now you can visit localhost:4000
from your browser.
Become an admin:
localhost:4000/admin
Enable GIPHY Integration:
ctrl+C, a, Enter
)export GIPHY_API_KEY=your_GIPHY_API_key
mix phx.server
I am putting all my thoughts here on how to introduce you to ShlinkedIn code + Elixir / Phoenix. There's a lot of stuff here but do not be discouraged!
lib/shlinkedin_web/live/post_live/index.ex
. On line 15
you can see the following line:
{:ok,
socket
|> assign(posts: list_posts())
|> assign(random_profiles: Shlinkedin.Accounts.get_random_profiles(5))
|> assign(like_map: Timeline.like_map()), temporary_assigns: [posts: []]}
Note how we're assigning to the socket posts
as list_posts()
. And random_profiles
as Shlinkedin.Accounts.get_random_profiles(5)
. Then, if you navigate to lib/shlinkedin_web/live/post_live/index.html.leex
you can see the html for how everything is displayed. Fun! One thing to note here, is that the html has a crazy number of class attributes. This may look very messy and ugly to you, but it's actually by design—I'll get to this later but all the CSS is using tailwind, which is all the rage right now and honestly amazing.
return
keyword. Instead, functions just implicitly return stuff. This is pretty weird, but used to it now.Enum.map([1, 2, 3], fn x -> x * 2 end)
). This is tricky but does make code so much cleaner.