I have an API that I created myself here: https://db.ygoprodeck.com/api-guide/

I get roughly 20,000 requests per day on it but have asked by a couple of people to open source it.

I look into this and I'm not entirely sure what way I would go about it or if it's even a good idea.

I created the API using PHP so would it be simply uploading my PHP file to something like github?

This would normally be fine but I'm worried that I would be exposing my database structure as it makes database calls within the PHP file.

I also have my DB details in the PHP file but I understand that I could put them in a different file (that would not be open sourced) and then call that file. But does that defeat the purpose of having it transparent and open sourced?

I'm not sure what the etiquette is here.

  • By "exposing my database information" are you worried about exposing your password/credentials, or worried about exposing your database schema (column names, types, etc.)?
    – apsillers
    Jan 17, 2020 at 2:30
  • @apsillers Both! I know the password/credentials can be stored in a separate file that can be called but I'm also worried about showcasing the schema Jan 17, 2020 at 7:46
  • 4
    I suggest you ask the people that request you to open source your API what they exactly mean with that. I can see multiple interpretations, of which publishing the source of the service is the least likely. Other interpretations are that they want an open source library (in language X) that nicely wraps calls to your service in function/method calls, or that they believe calling the API creates a derived work with the implication that they need a copyright license to call the API. Jan 17, 2020 at 11:42
  • The etiquette is to not open source it. Do the parties making the threats have some dirt on you or something? Jan 17, 2020 at 22:51

1 Answer 1

  1. Uploading code to Github makes your code possible to read. It would not be legally possible to use unless you choose a license for your code. Github can suggest you some license options and help you with licensing your code. Make sure you choose the one that fits your needs.

  2. If you don't want to expose your DB structure, you can refactor your code in a way that DB-related code can be extracted and not published. Think of Layered-architecture, for instance.

  3. Consider moving credentials and other sensitive information into the configuration file, which will not be open-sourced. If you follow step 2 properly, that should be very easy to achieve.

When you opensource something you don't have to give away things which you don't want to give away. There's no ethical concerns (at least none that I am aware of) about hiding sensitive information when releasing an open-sourced product.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.