An interesting question, Toney Time. Thank you. Writing this out has helped me clarify some thoughts on the topic that I've been mulling over.
Lots of other posts are kind of knee-jerk in their simplistic responses; they are not necessarily wrong, but they may be incomplete.
For what it is worth, I will give you a silver star for thinking about this before starting to "write your own code"... much better to game through some scenarios now instead of going heads-down for 6 months or a year and running into legal issues).
Another silver star for plausible expectations e.g. not looking for "get rich fast" stuff. (Also it wouldn't hurt to spend a few brain cycles on "get rich fast" stuff; if you have a plausible idea why not go talk to the people at y-combinator).
At any rate, here are some questions for you to consider.
fyi - if you can't find good answers to these questions, that may be an indicator that you want to avoid thinking about good, potentially lucrative, ideas until you're in a position to work on them free and clear.
By the way, not thinking about such ideas includes, but is not limited to: avoiding putting things online (facebook posts, email) or anywhere else it would be discoverable.
1) WHEN ?
Can you clarify when you are doing the additional work?
If you plan on doing some midnight engineering (e.g. unpaid nights and weekends, with "unpaid" being the key word) then you might have a basis to claim ownership of the code.
I'm willing to give you the benefit of the doubt about this being a "employer funded" effort.
2) WHERE?
Where are you doing this additional work?
I make it a VERY clear point to do any of my own midnight engineering on my own personal hardware that NEVER connects to day-job infrastructure. This includes simple research into new languages and frameworks that are just not in use at my employer. So, buy an extra laptop. Rent a cloud instance if you need to. But it just seems like a Bad Idea to code something you want to OWN on somebody else's hardware.
3) LICENSING OPTIONS
Licensing model e.g. what is your release goal? This really is just an aspect of the next item, but seems important enough to be worth calling out separately.
If you just want open source of some kind, that should be easier to negotiate with your employer since they will ostensibly benefit as well. You mentioned "community effort", is the community license suitable for what your long term goals are?
4) PROFIT?
If you want the option to SELL your code, things get more complicated.
Things you need to answer here:
What is your potential market? e.g. How could they pay you, and WHY would they want to? (pro tip: the "why" part is more important than "how").
You can sell code as-is, or services (training, install, support, and integration).
There are a several ways you could go...
a) dual-license (look into what the MySQL kids were doing, see talend.com for similar "free" vs "premium" licensing, or maybe redhat with fedora and rhel).
b) fork (if it is open source, just assert a new version). Long term goals will influence your license choice today.
c) sales drivers. To understand this one, think about your current employer's sales model. How do they find new business (growing work for existing customers as well as attracting new customers)? You might be able to work out a commission on new business your "fabulous website" brings into the company. You might be able to negotiate ownership of said website, and if you ever part company from your employer you could conceivably refer customers to all players in this market space (e.g. where players is the set including your employer and their competitors).
5) EMPLOYEE AGREEMENT
What does your employee agreement say on the matter?
It may already answer the questions asked above. As many other posters observed, "work for hire" is common. I also tend to see "all your ideas belong to us, even the ones you have on vacation or in the shower or at the bar... pretty much any idea, any time, any where in the solar system, no matter what you are doing" kinds of clauses.
You can try amending your employee agreement if needed.
You may have more luck by focusing your ask.
I've done things in the past like adding clauses like:
"Employee retains ownership over all writing they do on their own time (including, but not limited to, blogs, books, magazine articles)"
"Employee retains ownership over all mobile device development they do on their own time and own hardware."
These were approved easily enough because neither was in direct competition with the company's "cash cows".
I suspect your employee agreement basically says "they own everything you do and everything you think of".
If you ask them to amend it, they may approve. Most companies would simply become paranoid of you trying for even MAKING a request to compete with them and flag you for scrutiny so if you do start a company some day they can claim the request as a basis for discovery and really sift through your shit (all servers, all files, and subpoenas for all online providers like gmail, yahoo mail, facebook, github, etc. ) with a fine tooth comb (assuming actual money is involved).
And why would you even raise the question if you didn't think there was a slight chance that real money may be involved at some point?
5b) AMENDING EMPLOYEE AGREEMENT
If you need to put a new agreement in place, it may be easier just to look for a new job.
But if you want to try changing your existing employee agreement, think about how to make it ATTRACTIVE for your employer (and their collective management chain) to actually change it.
Think of how to structure a deal where your work would HELP their business, not actually compete with it.
a) "Here is how it can bring in new customers; I only want 5% of all gross revenue from new projects." (seems easier to track gross revenue than actual net.
see here to take a lesson from the movie industry.). For a mind blowing example of this, here is an excerpt from the wikipedia page:
"According to Lucasfilm, Return of the Jedi, despite having earned $475 million at the box office against a budget of $32.5 million, 'has never gone into profit'". I would never accept a deal on "profit" because the definition of profit is so insanely slippery as to be worse than worthless.
b) "We can set up unlimited non-exclusive rights to use current versions at whatever percentage, so you never lose existing customers." (up until such time as you are no longer employed, they keep non-exclusive unlimited rights to all work done to date, anything new versions post-employment are out of scope).
c) "I can give you binaries at 2.5% of the gross, I'm ok with full source code at 5% of the gross." Just a leverage point you have.
d) "It has ZERO additional cost to you; if I create something profitable, it will increase your revenue. If what I create is unprofitable, you have zero loss... just my time and effort on weekends takes the hit."
Just an aside, I don't know if 2.5% or 5% are reasonable numbers. Assuming you create something on your own time and effort, that may be a very reasonable thing to ask for if you can bring a brand new project, or account, into the company.
Implication: if you set this up, you'll want a way to track the potential new customers so you can stake claims on new business as appropriate. It would be unfortunate to lose a claim because "yeah, customer $BAR did use your website in 2016 but we called them back in 2015 so they're not a new customer."
Implication: I think it is important to retain ownership of the code in question because if you don't like how they're playing, you at least have the possibility to take your ball to a different playground. I say "possibility" because I don't know anything about the market your involved in.
There are tons of shenanigans you'll have to think your way through before you put any agreements into place.